Module: RSpec::Rails::Matchers::RoutingMatchers

Extended by:
Matchers::DSL
Included in:
ControllerExampleGroup, RoutingExampleGroup
Defined in:
lib/rspec/rails/matchers/routing_matchers.rb

Defined Under Namespace

Modules: RouteHelpers Classes: BeRoutableMatcher, RouteToMatcher

Instance Method Summary (collapse)

Instance Method Details

- (Object) be_routable

Passes if the route expression is recognized by the Rails router based on the declarations in config/routes.rb. Delegates to RouteSet#recognize_path.

You can use route helpers provided by rspec-rails. => "/a/path".should be_routable => "/another/path".should be_routable => "/yet/another/path".should_not be_routable



99
100
101
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 99

def be_routable
  BeRoutableMatcher.new(self)
end

- (Object) route_to(*expected)

Delegates to assert_recognizes. Supports short-hand controller/action declarations (e.g. "controller#action").

Examples:


{ :get => "/things/special" }.should route_to(
  :controller => "things",
  :action     => "special"
)

{ :get => "/things/special" }.should route_to("things#special")

See Also:



60
61
62
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 60

def route_to(*expected)
  RouteToMatcher.new(self, *expected)
end