Created
August 10, 2021 19:05
-
-
Save kirillplatonov/c649ae94033b10638c840449118189a4 to your computer and use it in GitHub Desktop.
Testing JWT app
This file contains 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
# Integration tests | |
def login(shop) | |
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] | |
Rails.application.env_config['omniauth.params'] = { shop: shop.shopify_domain } | |
Rails.application.env_config['jwt.shopify_domain'] = shop.shopify_domain | |
post "/auth/shopify" | |
follow_redirect! | |
end | |
# System tests | |
def login(shop) | |
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] | |
Rails.application.env_config['omniauth.params'] = { shop: shop.shopify_domain } | |
Rails.application.env_config['jwt.shopify_domain'] = shop.shopify_domain | |
visit "/auth/shopify" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be part of the example app I guess. I will move it later on.