Sha256: b1c9d5e4fc3582a6ce0a61ed09af75762a9a412db074765fab1c86767f08948d

Contents?: true

Size: 917 Bytes

Versions: 5

Compression:

Stored size: 917 Bytes

Contents

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

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

  context "a controller that sets a session variable" do
    setup do
      @controller = build_response { session[:var] = 'value' }
    end

    should "accept assigning to that variable" do
      assert_accepts set_session(:var), @controller
    end

    should "accept assigning the correct value to that variable" do
      assert_accepts set_session(:var).to('value'), @controller
    end

    should "reject assigning another value to that variable" do
      assert_rejects set_session(:var).to('other'), @controller
    end

    should "reject assigning to another variable" do
      assert_rejects set_session(:other), @controller
    end

    should "accept assigning nil to another variable" do
      assert_accepts set_session(:other).to(nil), @controller
    end
  end

end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/matchers/controller/set_session_matcher_test.rb
Flamefork-shoulda-2.10.2 test/matchers/controller/set_session_matcher_test.rb
francois-shoulda-2.10.1 test/matchers/controller/set_session_matcher_test.rb
thoughtbot-shoulda-2.10.1 test/matchers/controller/set_session_matcher_test.rb
shoulda-2.10.1 test/matchers/controller/set_session_matcher_test.rb