Sha256: 316f27019490f8bec885f265f431e0535f0c1835c76865dd107d043d85931648

Contents?: true

Size: 1.71 KB

Versions: 26

Compression:

Stored size: 1.71 KB

Contents

Feature: route_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")

  Scenario: 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

  Scenario: 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

  Scenario: 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"

Version data entries

26 entries across 21 versions & 3 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/routing_specs/route_to_matcher.feature
rspec-rails-2.10.1 features/routing_specs/route_to_matcher.feature
rspec-rails-2.10.0 features/routing_specs/route_to_matcher.feature
rspec-rails-2.9.0 features/routing_specs/route_to_matcher.feature
rspec-rails-2.9.0.rc2 features/routing_specs/route_to_matcher.feature
rspec-rails-2.8.1 features/routing_specs/route_to_matcher.feature
rspec-rails-2.8.0 features/routing_specs/route_to_matcher.feature
rspec-rails-2.8.0.rc2 features/routing_specs/route_to_matcher.feature