Sha256: 9d887df158caf6a58257531b0feb8b128f1b74fba91b2673ce113480e85fd178

Contents?: true

Size: 1.36 KB

Versions: 29

Compression:

Stored size: 1.36 KB

Contents

Feature: redirect_to matcher

  The `redirect_to` matcher is used to specify that a request redirects to a
  given template or action.  It delegates to
  [`assert_redirected_to`](http://api.rubyonrails.org/classes/ActionDispatch/Assertions/ResponseAssertions.html#method-i-assert_redirected_to).

  It is available in controller specs (spec/controllers) and request
  specs (spec/requests).

  Scenario: redirect_to with four possible options
    Given a file named "spec/controllers/widgets_controller_spec.rb" with:
      """
      require "spec_helper"

      describe WidgetsController do

        describe "#create" do
          subject { post :create, :widget => { :name => "Foo" } }

          it "redirects to widget_url(@widget)" do
            subject.should redirect_to(widget_url(assigns(:widget)))
          end

          it "redirects_to :action => :show" do
            subject.should redirect_to :action => :show,
                                       :id => assigns(:widget).id
          end

          it "redirects_to(@widget)" do
            subject.should redirect_to(assigns(:widget))
          end

          it "redirects_to /widgets/:id" do
            subject.should redirect_to("/widgets/#{assigns(:widget).id}")
          end
        end
      end
      """
    When I run `rspec spec/controllers/widgets_controller_spec.rb`
    Then the examples should all pass

Version data entries

29 entries across 24 versions & 4 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_to_matcher.feature
rspec-rails-2.11.4 features/matchers/redirect_to_matcher.feature
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/features/matchers/redirect_to_matcher.feature
rspec-rails-2.11.0 features/matchers/redirect_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/matchers/redirect_to_matcher.feature
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_to_matcher.feature
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_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/matchers/redirect_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/matchers/redirect_to_matcher.feature
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_to_matcher.feature
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_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/matchers/redirect_to_matcher.feature
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_to_matcher.feature
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_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/matchers/redirect_to_matcher.feature
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/features/matchers/redirect_to_matcher.feature
rspec-rails-2.10.1 features/matchers/redirect_to_matcher.feature
rspec-rails-2.10.0 features/matchers/redirect_to_matcher.feature
rspec-rails-2.9.0 features/matchers/redirect_to_matcher.feature
rspec-rails-2.9.0.rc2 features/matchers/redirect_to_matcher.feature