Sha256: ccc1f2b824046e4efcc0dcecb92d8bfdaf27abeccabae5d2fae976d2b9563c1d

Contents?: true

Size: 1.38 KB

Versions: 91

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

class SetSessionMatcherTest < ActionController::TestCase # :nodoc:

  context "a controller that sets a session variable" do
    setup do
      @controller = build_response do
        session[:var] = 'value'
        session[:false_var] = false
      end
    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

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

    should "accept assigning to the same value in the test context" do
      @expected = 'value'
      assert_accepts set_session(:var).to { @expected }, @controller
    end

    should "reject assigning to the another value in the test context" do
      @expected = 'other'
      assert_rejects set_session(:var).to { @expected }, @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/set_session_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/set_session_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/set_session_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
challah-0.6.2 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
challah-0.6.1 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb
challah-0.6.0 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/set_session_matcher_test.rb