Sha256: 34b612fb28813e9b9af19331cd60c7a615b85a16a664726e9688fd49207a45d9

Contents?: true

Size: 1.14 KB

Versions: 28

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Shoulda::Matchers::ActionController::RedirectToMatcher do
  context "a controller that redirects" do
    let(:controller) do
      build_response { redirect_to '/some/url' }
    end

    it "accepts redirecting to that url" do
      controller.should redirect_to('/some/url')
    end

    it "rejects redirecting to a different url" do
      controller.should_not redirect_to('/some/other/url')
    end

    it "accepts redirecting to that url in a block" do
      controller.should redirect_to('somewhere') { '/some/url' }
    end

    it "rejects redirecting to a different url in a block" do
      controller.should_not redirect_to('somewhere else') { '/some/other/url' }
    end
  end

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

    it "rejects redirecting to a url" do
      controller.should_not redirect_to('/some/url')
    end
  end

  it "provides the correct description when provided a block" do
    matcher = redirect_to('somewhere else') { '/some/other/url' }
    matcher.description.should == 'redirect to somewhere else'
  end
end

Version data entries

28 entries across 20 versions & 4 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
devise_sociable-0.1.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-0.9.1.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-0.9.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
shoulda-matchers-1.4.2 spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
shoulda-matchers-1.4.1 spec/shoulda/action_controller/redirect_to_matcher_spec.rb
shoulda-matchers-1.4.0 spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-0.8.1 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/redirect_to_matcher_spec.rb