Files
mozo-backend/spec/support/route_helpers.rb
T

16 lines
489 B
Ruby

module SpecRouteHelpers
# allows tests like:
# route_should_be 'agama_groups#index'
def route_should_be(route_def)
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
Rails.application.routes.recognize_path(page.current_path).should include route_hash
end
end