Sha256: f14224a2f52a572b346881d1553fa807e8bd2246092fe9de820f6a3917e48c82

Contents?: true

Size: 822 Bytes

Versions: 7

Compression:

Stored size: 822 Bytes

Contents

require 'test_helper'

class DiscoApp::SessionTest < ActiveSupport::TestCase

  def setup
    @shop = disco_app_shops(:widget_store)
    @session = DiscoApp::Session.create(
      session_id: 'a91bfc51fa79c9d09d43e2615d9345d4',
      data: {
        shopify: @shop.id,
        shopify_domain: @shop.shopify_domain
      }
    )
  end

  test 'logged in sessions are linked to their shop' do
    assert_equal @shop.id, @session.shop_id
  end

  test 'can fetch sessions for a particular shop through association' do
    assert_equal 1, @shop.sessions.size
  end

  test 'sessions can be deleted by shop' do
    DiscoApp::Session.create(session_id: 'a91bfc51fa79c9d09d43e2615d9345d5', data: {})
    assert_equal 2, DiscoApp::Session.count
    @shop.sessions.delete_all
    assert_equal 1, DiscoApp::Session.count
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.17.0 test/models/disco_app/session_test.rb
disco_app-0.18.0 test/models/disco_app/session_test.rb
disco_app-0.18.2 test/models/disco_app/session_test.rb
disco_app-0.18.3 test/models/disco_app/session_test.rb
disco_app-0.18.6 test/models/disco_app/session_test.rb
disco_app-0.18.4 test/models/disco_app/session_test.rb
disco_app-0.18.1 test/models/disco_app/session_test.rb