Last active
July 23, 2020 22:43
-
-
Save philippegirard/d5282d8152a2f1fa79fde161f44b843f to your computer and use it in GitHub Desktop.
Test Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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