Module: ShopifyApp::TestHelpers::ShopifySessionHelper

Defined in:
lib/shopify_app/test_helpers/shopify_session_helper.rb

Instance Method Summary collapse

Instance Method Details

#setup_shopify_session(session_id:, shop_domain:) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/shopify_app/test_helpers/shopify_session_helper.rb', line 6

def setup_shopify_session(session_id:, shop_domain:)
  ShopifyAPI::Auth::Session.new(id: session_id, shop: shop_domain).tap do |session|
    ShopifyApp::SessionRepository.stubs(:load_session).returns(session)
    ShopifyAPI::Utils::SessionUtils.stubs(:current_session_id).returns(session.id)
    ShopifyAPI::Context.activate_session(session)
  end
end