Sha256: 12681d58677ce23a7fdaac6db23218e91b62b250358caf99c1552c6caa719d0a

Contents?: true

Size: 1 KB

Versions: 91

Compression:

Stored size: 1 KB

Contents

require 'test_helper'

class RedirectToMatcherTest < ActionController::TestCase # :nodoc:

  context "a controller that redirects" do
    setup do
      @controller = build_response { redirect_to '/some/url' }
    end

    should "accept redirecting to that url" do
      assert_accepts redirect_to('/some/url'), @controller
    end

    should "reject redirecting to a different url" do
      assert_rejects redirect_to('/some/other/url'), @controller
    end

    should "accept redirecting to that url in a block" do
      assert_accepts redirect_to('somewhere') { '/some/url' }, @controller
    end

    should "reject redirecting to a different url in a block" do
      assert_rejects redirect_to('somewhere else') { '/some/other/url' }, @controller
    end
  end

  context "a  controller that doesn't redirect" do
    setup do
      @controller = build_response { render :text => 'hello' }
    end

    should "reject redirecting to a url" do
      assert_rejects redirect_to('/some/url'), @controller
    end
  end

end

Version data entries

91 entries across 61 versions & 10 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
challah-0.6.2 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
challah-0.6.1 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb
challah-0.6.0 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/redirect_to_matcher_test.rb