Skip to content

Instantly share code, notes, and snippets.

@philippegirard
Last active July 23, 2020 22:43
Show Gist options
  • Save philippegirard/d5282d8152a2f1fa79fde161f44b843f to your computer and use it in GitHub Desktop.
Save philippegirard/d5282d8152a2f1fa79fde161f44b843f to your computer and use it in GitHub Desktop.
Test Helper
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
# DO NOT FORGET THIS.
OmniAuth.config.test_mode = true
class ActiveSupport::TestCase
# ...some code here
def login_shop(shop)
OmniAuth.config.logger = Rails.logger # remove this line for omniAuth logs
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:shopify,
provider: 'shopify',
uid: shop.shopify_domain,
credentials: {token: shop.shopify_token}
)
Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:shopify]
get "/auth/shopify"
follow_redirect!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment