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 collaboratorbe_routable matcher
The be_routable
matcher is best used with should_not
to specify that a
given route should not be routable. It is available in routing specs (in
spec/routing) and controller specs (in spec/controllers).
- Scenarios
-
- specify routeable route should not be routable (fails)
- specify non-routeable route should not be routable (passes)
- specify routeable route should be routable (passes)
- specify non-routeable route should be routable (fails)
- be_routable in a controller spec
- specify routeable route should not be routable (fails)
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "rails_helper" RSpec.describe "routes for Widgets", :type => :routing do it "does not route to widgets" do expect(:get => "/widgets").not_to be_routable end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the output should contain "1 example, 1 failure"
- specify non-routeable route should not be routable (passes)
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "rails_helper" RSpec.describe "routes for Widgets", :type => :routing do it "does not route to widgets/foo/bar" do expect(:get => "/widgets/foo/bar").not_to be_routable end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the examples should all pass
- specify routeable route should be routable (passes)
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "rails_helper" RSpec.describe "routes for Widgets", :type => :routing do it "routes to /widgets" do expect(:get => "/widgets").to be_routable end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the examples should all pass
- specify non-routeable route should be routable (fails)
-
- Given
-
a file named "spec/routing/widgets_routing_spec.rb" with:
require "rails_helper" RSpec.describe "routes for Widgets", :type => :routing do it "routes to widgets/foo/bar" do expect(:get => "/widgets/foo/bar").to be_routable end end
- When
-
I run
rspec spec/routing/widgets_routing_spec.rb
- Then
- the output should contain "1 example, 1 failure"
- be_routable in a controller spec
-
- Given
-
a file named "spec/controllers/widgets_controller_spec.rb" with:
require "rails_helper" RSpec.describe WidgetsController, :type => :routing do it "routes to /widgets" do expect(:get => "/widgets").to be_routable end end
- When
-
I run
rspec spec/controllers/widgets_controller_spec.rb
- Then
- the examples should all pass
Last published over 2 years ago by Jon Rowe.