To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorroute_to matcher
The route_to
matcher specifies that a request (verb + path) is routable.
It is most valuable when specifying routes other than standard RESTful
routes.
get("/").should route_to("welcome#index") # new in 2.6.0
or
{ :get => "/" }.should route_to(:controller => "welcome")
- Scenarios
-
- passing route spec with shortcut syntax
- passing route spec with verbose syntax
- route spec for a route that doesn't exist (fails)
- route spec for a namespaced route with shortcut specifier
- route spec for a namespaced route with verbose specifier
- passing route spec with shortcut syntax
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "spec_helper" describe "routes for Widgets" do it "routes /widgets to the widgets controller" do get("/widgets"). should route_to("widgets#index") end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the examples should all pass
- passing route spec with verbose syntax
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "spec_helper" describe "routes for Widgets" do it "routes /widgets to the widgets controller" do { :get => "/widgets" }. should route_to(:controller => "widgets", :action => "index") end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the examples should all pass
- route spec for a route that doesn't exist (fails)
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "spec_helper" describe "routes for Widgets" do it "routes /widgets/foo to the /foo action" do get("/widgets/foo").should route_to("widgets#foo") end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the output should contain "1 failure"
- route spec for a namespaced route with shortcut specifier
-
- Given
-
a file named "spec/routing/admin_routing_spec.rb" with:
require "spec_helper" describe "routes for Widgets" do it "routes /admin/accounts to the admin/accounts controller" do get("/admin/accounts"). should route_to("admin/accounts#index") end end
- When
-
I run
rspec spec/routing/admin_routing_spec.rb
- Then
- the examples should all pass
- route spec for a namespaced route with verbose specifier
-
- Given
-
a file named "spec/routing/admin_routing_spec.rb" with:
require "spec_helper" describe "routes for Widgets" do it "routes /admin/accounts to the admin/accounts controller" do get("/admin/accounts"). should route_to(:controller => "admin/accounts", :action => "index") end end
- When
-
I run
rspec spec/routing/admin_routing_spec.rb
- Then
- the examples should all pass
Last published over 7 years ago by .