Sha256: 9ef0fb928d4178ed57b3ea81b0e7a4c605893283aebbb27ca3fa0551e5e6b9fc

Contents?: true

Size: 1.03 KB

Versions: 17

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class InMemorySessionStoreTest < ActiveSupport::TestCase
  teardown do
    InMemorySessionStore.clear
  end

  test "storing a session" do
    uuid = InMemorySessionStore.store('something')
    assert_equal 'something', InMemorySessionStore.repo[uuid]
  end

  test "retrieving a session" do
    InMemorySessionStore.repo['abra'] = 'something'
    assert_equal 'something', InMemorySessionStore.retrieve('abra')
  end

  test "clearing the store" do
    uuid = InMemorySessionStore.store('data')
    assert_equal 'data', InMemorySessionStore.retrieve(uuid)
    InMemorySessionStore.clear
    assert !InMemorySessionStore.retrieve(uuid), 'The sessions should have been removed'
  end

  test "it should raise when the environment is not valid" do
    Rails.env.stubs(:production?).returns(true)
    assert_raises InMemorySessionStore::EnvironmentError do
      InMemorySessionStore.store('data')
    end

    assert_raises InMemorySessionStore::EnvironmentError do
      InMemorySessionStore.retrieve('abracadabra')
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shopify_app-6.4.2 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.4.1 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.4.0 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.3.0 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.2.1 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.2.0 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.1.3 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.1.2 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.1.1 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.1.0 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.6 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.5 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.4 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.3 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.2 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.1 test/shopify_app/in_memory_session_store_test.rb
shopify_app-6.0.0 test/shopify_app/in_memory_session_store_test.rb