Sha256: 85a802b7e9f3212d4613e020246adc0165cedf9fcda71abdf3a93e1ca30a5280

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')

class SetTheFlashMatcherTest < Test::Unit::TestCase # :nodoc:

  context "a controller that sets a flash message" do
    setup do
      @controller = build_response { flash[:notice] = 'value' }
    end

    should "accept setting any flash message" do
      assert_accepts set_the_flash, @controller
    end

    should "accept setting the exact flash message" do
      assert_accepts set_the_flash.to('value'), @controller
    end

    should "accept setting a matched flash message" do
      assert_accepts set_the_flash.to(/value/), @controller
    end

    should "reject setting a different flash message" do
      assert_rejects set_the_flash.to('other'), @controller
    end

    should "reject setting a different pattern" do
      assert_rejects set_the_flash.to(/other/), @controller
    end
  end

  context "a controller that doesn't set a flash message" do
    setup do
      @controller = build_response
    end

    should "reject setting any flash message" do
      assert_rejects set_the_flash, @controller
    end
  end

end

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/matchers/controller/set_the_flash_matcher.rb
Flamefork-shoulda-2.10.2 test/matchers/controller/set_the_flash_matcher.rb
francois-shoulda-2.10.1 test/matchers/controller/set_the_flash_matcher.rb
technicalpickles-shoulda-2.10.0 test/matchers/controller/set_the_flash_matcher.rb
thoughtbot-shoulda-2.10.0 test/matchers/controller/set_the_flash_matcher.rb
thoughtbot-shoulda-2.10.1 test/matchers/controller/set_the_flash_matcher.rb
thoughtbot-shoulda-2.9.2 test/matchers/controller/set_the_flash_matcher.rb
shoulda-2.9.2 test/matchers/controller/set_the_flash_matcher.rb
shoulda-2.10.0 test/matchers/controller/set_the_flash_matcher.rb
shoulda-2.10.1 test/matchers/controller/set_the_flash_matcher.rb