Sha256: 6f710aa2e2c204abfe876bf7053cda8e8257654fee9c41836ce9d389f866bffb

Contents?: true

Size: 1.36 KB

Versions: 28

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe Shoulda::Matchers::ActionController::SetSessionMatcher do
  context "a controller that sets a session variable" do
    let(:controller) do
      build_response do
        session[:var] = 'value'
        session[:false_var] = false
      end
    end

    it "should accept assigning to that variable" do
      controller.should set_session(:var)
    end

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

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

    it "should reject assigning to another variable" do
      controller.should_not set_session(:other)
    end

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

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

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

    it "should reject assigning to the another value in the test context" do
      expected = 'other'
      controller.should_not set_session(:var).in_context(self).to { expected }
    end
  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/set_session_matcher_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/set_session_matcher_spec.rb
devise_sociable-0.1.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-0.9.1.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-0.9.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/set_session_matcher_spec.rb
shoulda-matchers-1.4.2 spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/set_session_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/set_session_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/set_session_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/set_session_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/set_session_matcher_spec.rb
shoulda-matchers-1.4.1 spec/shoulda/action_controller/set_session_matcher_spec.rb
shoulda-matchers-1.4.0 spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-0.8.1 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/set_session_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/set_session_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/set_session_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/set_session_matcher_spec.rb