module RSpec::Rails::Matchers::RoutingMatchers
Matchers to help with specs for routing code.
Public Instance Methods
be_routable()
click to toggle source
Passes if the route expression is recognized by the Rails router based on the declarations in `config/routes.rb`. Delegates to `RouteSet#recognize_path`.
@example You can use route helpers provided by rspec-rails.
expect(get: "/a/path").to be_routable expect(post: "/another/path").to be_routable expect(put: "/yet/another/path").to be_routable
# File lib/rspec/rails/matchers/routing_matchers.rb, line 101 def be_routable BeRoutableMatcher.new(self) end
route_to(*expected)
click to toggle source
Delegates to `assert_recognizes`. Supports short-hand controller/action declarations (e.g. `“controller#action”`).
@example
expect(get: "/things/special").to route_to( controller: "things", action: "special" ) expect(get: "/things/special").to route_to("things#special")
# File lib/rspec/rails/matchers/routing_matchers.rb, line 61 def route_to(*expected) RouteToMatcher.new(self, *expected) end