module SpecRouteHelpers # allows tests like: # route_should_be 'agama_groups#index' def route_should_be(route_def, options = {}) route_hash = case route_def when String controller_name, action_name = route_def.split('#') #action_name = 'index' unless action_name.present? {controller: controller_name, action: action_name} else route_def end route_hash.merge! options Rails.application.routes.recognize_path(page.current_path).should include route_hash end end