disco_app 0.13.6.pre.puma.pre.3 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/images/disco_app/logo.png +0 -0
- data/app/clients/disco_app/rollbar_client.rb +53 -0
- data/app/clients/disco_app/rollbar_client_error.rb +2 -0
- data/app/controllers/disco_app/concerns/app_proxy_controller.rb +1 -1
- data/app/controllers/disco_app/concerns/authenticated_controller.rb +10 -1
- data/app/controllers/disco_app/concerns/user_authenticated_controller.rb +2 -2
- data/app/controllers/disco_app/user_sessions_controller.rb +1 -1
- data/app/controllers/disco_app/webhooks_controller.rb +1 -1
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/jobs/application_job.rb +2 -0
- data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +26 -9
- data/app/jobs/disco_app/shop_job.rb +1 -1
- data/app/models/application_record.rb +3 -0
- data/app/models/disco_app/app_settings.rb +1 -1
- data/app/models/disco_app/application_charge.rb +8 -2
- data/app/models/disco_app/concerns/can_be_liquified.rb +5 -4
- data/app/models/disco_app/concerns/plan.rb +12 -3
- data/app/models/disco_app/concerns/plan_code.rb +4 -1
- data/app/models/disco_app/concerns/shop.rb +9 -1
- data/app/models/disco_app/concerns/subscription.rb +11 -4
- data/app/models/disco_app/concerns/synchronises.rb +1 -1
- data/app/models/disco_app/plan.rb +1 -1
- data/app/models/disco_app/plan_code.rb +1 -1
- data/app/models/disco_app/recurring_application_charge.rb +9 -2
- data/app/models/disco_app/shop.rb +1 -1
- data/app/models/disco_app/source.rb +1 -1
- data/app/models/disco_app/subscription.rb +1 -1
- data/app/models/disco_app/user.rb +1 -1
- data/app/services/disco_app/partner_app_service.rb +151 -0
- data/db/migrate/20150525000000_create_shops_if_not_existent.rb +1 -1
- data/db/migrate/20170315062548_create_disco_app_sources.rb +1 -1
- data/db/migrate/20170315062629_add_sources_to_shop_subscriptions.rb +1 -1
- data/db/migrate/20170327214540_create_disco_app_users.rb +1 -1
- data/db/migrate/20170606160751_fix_disco_app_users_index.rb +1 -1
- data/lib/disco_app/version.rb +1 -1
- data/lib/generators/disco_app/disco_app_generator.rb +17 -18
- data/lib/generators/disco_app/templates/initializers/shopify_session_repository.rb +2 -1
- data/lib/generators/disco_app/templates/root/README.md +26 -0
- data/lib/tasks/partner_app.rake +26 -0
- data/lib/tasks/rollbar.rake +24 -0
- data/test/controllers/disco_app/charges_controller_test.rb +11 -11
- data/test/controllers/disco_app/subscriptions_controller_test.rb +4 -4
- data/test/controllers/disco_app/webhooks_controller_test.rb +5 -5
- data/test/controllers/home_controller_test.rb +1 -1
- data/test/controllers/proxy_controller_test.rb +3 -3
- data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +1 -1
- data/test/dummy/app/controllers/proxy_controller.rb +1 -1
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/cart.rb +1 -1
- data/test/dummy/app/models/disco_app/shop.rb +1 -1
- data/test/dummy/app/models/js_configuration.rb +1 -1
- data/test/dummy/app/models/product.rb +1 -1
- data/test/dummy/app/models/widget_configuration.rb +1 -1
- data/test/dummy/config/application.rb +0 -3
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/initializers/shopify_session_repository.rb +1 -1
- data/test/dummy/db/migrate/20160307182229_create_products.rb +2 -2
- data/test/dummy/db/migrate/20160530160739_create_asset_models.rb +2 -2
- data/test/dummy/db/migrate/20161105054746_create_carts.rb +3 -2
- data/test/dummy/db/schema.rb +89 -96
- data/test/fixtures/disco_app/shops.yml +6 -2
- data/test/fixtures/liquid/model.liquid +8 -8
- data/test/integration/synchronises_test.rb +15 -9
- data/test/jobs/disco_app/synchronise_webhooks_job_test.rb +16 -4
- data/test/test_helper.rb +13 -0
- data/test/vcr/webhook_failure.yml +640 -0
- metadata +81 -38
@@ -6,10 +6,12 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
6
6
|
#
|
7
7
|
# - .env and .env.local for settings environment variables in development with dotenv-rails;
|
8
8
|
# - Slightly customised version of the default Rails .gitignore;
|
9
|
-
# - Default simple Procfile for Heroku
|
9
|
+
# - Default simple Procfile for Heroku;
|
10
|
+
# - .editorconfig to help enforce 2-space tabs, newlines and truncated whitespace for editors that support it.
|
11
|
+
# - README template
|
10
12
|
#
|
11
13
|
def copy_root_files
|
12
|
-
%w(.env .env.local .gitignore .rubocop.yml .codeclimate.yml Procfile CHECKS).each do |file|
|
14
|
+
%w(.editorconfig .env .env.local .gitignore .rubocop.yml .codeclimate.yml Procfile CHECKS README.md).each do |file|
|
13
15
|
copy_file "root/#{file}", file
|
14
16
|
end
|
15
17
|
end
|
@@ -27,28 +29,25 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
27
29
|
gsub_file 'Gemfile', /^# Use sqlite3 as the database for Active Record\ngem 'sqlite3'/m, ''
|
28
30
|
|
29
31
|
# Add gem requirements.
|
30
|
-
gem 'shopify_app'
|
31
|
-
gem 'pg'
|
32
|
-
gem 'sidekiq'
|
33
|
-
gem 'rollbar'
|
34
|
-
gem 'newrelic_rpm'
|
35
|
-
gem 'react-rails'
|
36
|
-
gem 'classnames-rails'
|
37
|
-
gem 'premailer-rails'
|
38
|
-
gem 'rails-bigint-pk'
|
39
|
-
gem 'acts_as_singleton'
|
40
32
|
gem 'active_link_to'
|
33
|
+
gem 'acts_as_singleton'
|
34
|
+
gem 'classnames-rails'
|
35
|
+
gem 'newrelic_rpm'
|
41
36
|
gem 'nokogiri'
|
42
37
|
gem 'oj'
|
38
|
+
gem 'pg'
|
39
|
+
gem 'premailer-rails'
|
40
|
+
gem 'react-rails'
|
43
41
|
gem 'render_anywhere'
|
44
|
-
|
45
|
-
|
46
|
-
gem '
|
42
|
+
gem 'rollbar'
|
43
|
+
gem 'shopify_app'
|
44
|
+
gem 'sidekiq'
|
45
|
+
gem 'activeresource'
|
47
46
|
|
48
47
|
# Indicate which gems should only be used in production.
|
49
48
|
gem_group :production do
|
50
|
-
gem 'rails_12factor'
|
51
49
|
gem 'mailgun_rails'
|
50
|
+
gem 'rails_12factor'
|
52
51
|
end
|
53
52
|
|
54
53
|
# Indicate which gems should only be used in development and test.
|
@@ -56,6 +55,7 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
56
55
|
gem 'dotenv-rails'
|
57
56
|
gem 'minitest-reporters'
|
58
57
|
gem 'webmock'
|
58
|
+
gem 'mechanize'
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -163,7 +163,6 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
163
163
|
def run_generators
|
164
164
|
generate 'shopify_app:install'
|
165
165
|
generate 'shopify_app:home_controller'
|
166
|
-
generate 'bigint_pk:install'
|
167
166
|
generate 'react:install'
|
168
167
|
end
|
169
168
|
|
@@ -221,7 +220,7 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
221
220
|
# This should be the last operation, to allow all other operations to run in the initial Ruby version.
|
222
221
|
def set_ruby_version
|
223
222
|
copy_file 'root/.ruby-version', '.ruby-version'
|
224
|
-
prepend_to_file 'Gemfile', "ruby '2.
|
223
|
+
prepend_to_file 'Gemfile', "ruby '2.5.0'\n"
|
225
224
|
end
|
226
225
|
|
227
226
|
private
|
@@ -1,7 +1,8 @@
|
|
1
1
|
if Rails.configuration.cache_classes
|
2
2
|
ShopifyApp::SessionRepository.storage = DiscoApp::SessionStorage
|
3
3
|
else
|
4
|
-
ActionDispatch::Reloader
|
4
|
+
reloader = defined?(ActiveSupport::Reloader) ? ActiveSupport::Reloader : ActionDispatch::Reloader
|
5
|
+
reloader.to_prepare do
|
5
6
|
ShopifyApp::SessionRepository.storage = DiscoApp::SessionStorage
|
6
7
|
end
|
7
8
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# App title
|
2
|
+
A short overview of what the application is designed to do goes here. Also include the current usage of the app (eg, which clients are using it, how many stores, etc).
|
3
|
+
|
4
|
+
## Setup
|
5
|
+
See [section 3 and 4 of the Disco App README](https://github.com/discolabs/disco_app#3-setting-up-the-shopify-app) for standard steps on setting up a Disco Rails App.
|
6
|
+
|
7
|
+
## Deployment
|
8
|
+
See [this Guru card](https://app.getguru.com/#/facts/879686cb-e74a-4814-b45f-06e568d89c10) for the standard steps on deploying an existing DiscoRails App.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
A guide to installing the app onto a new store.
|
12
|
+
|
13
|
+
## Functionality
|
14
|
+
A list of the features of the app, and what it achieves (ie, the requirements it meets).
|
15
|
+
|
16
|
+
## External systems
|
17
|
+
A list of the external systems the application interacts with.
|
18
|
+
|
19
|
+
## Data flow
|
20
|
+
A description of how data flows through the application, if applicable, or a description of the common processes/functions the app performs.
|
21
|
+
|
22
|
+
## Notes
|
23
|
+
A section to note anything particularly noteworthy about this app.
|
24
|
+
|
25
|
+
## Troubleshooting / FAQ
|
26
|
+
Potentially common problems and their solutions.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
namespace :generate do
|
4
|
+
desc 'Generate new Shopify app from partner dashboard'
|
5
|
+
task partner_app: :environment do
|
6
|
+
begin
|
7
|
+
config_path = File.join(ENV['HOME'], '.disco_app.yml')
|
8
|
+
config = YAML.load_file(config_path)
|
9
|
+
rescue StandardError
|
10
|
+
abort("Could not load configuration file from #{config_path}, aborting.")
|
11
|
+
end
|
12
|
+
|
13
|
+
if config
|
14
|
+
params = {
|
15
|
+
email: config['params']['PARTNER_EMAIL'].to_s,
|
16
|
+
password: config['params']['PARTNER_PASSWORD'].to_s,
|
17
|
+
organization: config['params']['PARTNER_ORGANIZATION'].to_s,
|
18
|
+
app_name: ENV['SHOPIFY_APP_NAME'],
|
19
|
+
app_url: ENV['DEFAULT_HOST']
|
20
|
+
}
|
21
|
+
|
22
|
+
service = DiscoApp::PartnerAppService.new(params)
|
23
|
+
service.generate_partner_app
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
namespace :generate do
|
4
|
+
desc "Create Rollbar project for current shopify app, and return the ROLLBAR API TOKEN"
|
5
|
+
task rollbar_project: :environment do
|
6
|
+
begin
|
7
|
+
config_path = File.join(ENV['HOME'], '.disco_app.yml')
|
8
|
+
config = YAML.load_file(config_path)
|
9
|
+
rescue StandardError
|
10
|
+
abort("Could not load configuration file from #{config_path}, aborting.")
|
11
|
+
end
|
12
|
+
|
13
|
+
params = {
|
14
|
+
write_account_access_token: config['params']['ROLLBAR_ACCOUNT_ACCESS_TOKEN_WRITE'].to_s,
|
15
|
+
read_account_access_token: config['params']['ROLLBAR_ACCOUNT_ACCESS_TOKEN_READ'].to_s
|
16
|
+
}
|
17
|
+
|
18
|
+
project_access_token = DiscoApp::RollbarClient.new(params).create_project(ENV['APP_NAME'].blank? ? ENV['SHOPIFY_APP_NAME'] : ENV['APP_NAME'])
|
19
|
+
puts '#' * 80
|
20
|
+
puts 'New Rollbar project successfully created!'
|
21
|
+
puts "ROLLBAR_ACCESS_TOKEN = #{project_access_token}"
|
22
|
+
puts '#' * 80
|
23
|
+
end
|
24
|
+
end
|
@@ -21,24 +21,24 @@ class DiscoApp::ChargesControllerTest < ActionController::TestCase
|
|
21
21
|
|
22
22
|
test 'non-logged in user is redirected to the login page' do
|
23
23
|
log_out
|
24
|
-
get
|
24
|
+
get :new, params: { subscription_id: @current_subscription }
|
25
25
|
assert_redirected_to ShopifyApp::Engine.routes.url_helpers.login_path
|
26
26
|
end
|
27
27
|
|
28
28
|
test 'logged-in, never installed user is redirected to the install page' do
|
29
29
|
@shop.never_installed!
|
30
|
-
get
|
30
|
+
get :new, params: { subscription_id: @current_subscription }
|
31
31
|
assert_redirected_to DiscoApp::Engine.routes.url_helpers.install_path
|
32
32
|
end
|
33
33
|
|
34
34
|
test 'user with paid-for current subscription can not access page' do
|
35
|
-
get
|
35
|
+
get :new, params: { subscription_id: @current_subscription }
|
36
36
|
assert_redirected_to Rails.application.routes.url_helpers.root_path
|
37
37
|
end
|
38
38
|
|
39
39
|
test 'user with unpaid current subscription can access page' do
|
40
40
|
@current_subscription.active_charge.destroy
|
41
|
-
get
|
41
|
+
get :new, params: { subscription_id: @current_subscription }
|
42
42
|
assert_response :ok
|
43
43
|
end
|
44
44
|
|
@@ -47,26 +47,26 @@ class DiscoApp::ChargesControllerTest < ActionController::TestCase
|
|
47
47
|
"price": "9.99",
|
48
48
|
"trial_days": 14,
|
49
49
|
"return_url": /^https:\/\/test\.example\.com\/subscriptions\/304261385\/charges\/53297050(1|2)\/activate$/,
|
50
|
-
"test": true
|
50
|
+
"test": true
|
51
51
|
} }
|
52
52
|
stub_request(:post, "#{@shop.admin_url}/recurring_application_charges.json")
|
53
53
|
.with(body: res
|
54
54
|
).to_return(status: 201, body:api_fixture("widget_store/charges/create_second_recurring_application_charge_response").to_json)
|
55
55
|
|
56
56
|
@current_subscription.active_charge.destroy
|
57
|
-
post
|
57
|
+
post :create, params: { subscription_id: @current_subscription }
|
58
58
|
assert_redirected_to 'https://apple.myshopify.com/admin/charges/654381179/confirm_recurring_application_charge?signature=BAhpBHsQASc%3D--b2e90c6e4e94fbae15a464c566a31a1c23e6bffa'
|
59
59
|
end
|
60
60
|
|
61
61
|
test 'user trying to activate charge for invalid gets not found and hence 404' do
|
62
62
|
assert_raises ActiveRecord::RecordNotFound do
|
63
|
-
get
|
63
|
+
get :activate, params: { subscription_id: '123', id: '456', charge_id: '789' }
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
test 'user trying to activate invalid charge for valid subscription gets redirected to new charge page for that subscription' do
|
68
68
|
@current_subscription.active_charge.destroy
|
69
|
-
get
|
69
|
+
get :activate, params: { subscription_id: @current_subscription, id: '456', charge_id: '789' }
|
70
70
|
assert_redirected_to DiscoApp::Engine.routes.url_helpers.new_subscription_charge_path(@current_subscription)
|
71
71
|
end
|
72
72
|
|
@@ -74,7 +74,7 @@ class DiscoApp::ChargesControllerTest < ActionController::TestCase
|
|
74
74
|
stub_api_request(:get, "#{@shop.admin_url}/recurring_application_charges/654381179.json", 'widget_store/charges/get_pending_recurring_application_charge')
|
75
75
|
|
76
76
|
@current_subscription.active_charge.destroy
|
77
|
-
get
|
77
|
+
get :activate, params: { subscription_id: @current_subscription, id: @new_charge.id, charge_id: @new_charge.shopify_id }
|
78
78
|
assert_redirected_to DiscoApp::Engine.routes.url_helpers.new_subscription_charge_path(@current_subscription)
|
79
79
|
end
|
80
80
|
|
@@ -82,7 +82,7 @@ class DiscoApp::ChargesControllerTest < ActionController::TestCase
|
|
82
82
|
stub_api_request(:get, "#{@shop.admin_url}/recurring_application_charges/654381179.json", 'widget_store/charges/get_declined_recurring_application_charge')
|
83
83
|
|
84
84
|
@current_subscription.active_charge.destroy
|
85
|
-
get
|
85
|
+
get :activate, params: { subscription_id: @current_subscription, id: @new_charge.id, charge_id: @new_charge.shopify_id }
|
86
86
|
assert_redirected_to DiscoApp::Engine.routes.url_helpers.new_subscription_charge_path(@current_subscription)
|
87
87
|
end
|
88
88
|
|
@@ -91,7 +91,7 @@ class DiscoApp::ChargesControllerTest < ActionController::TestCase
|
|
91
91
|
stub_api_request(:post, "#{@shop.admin_url}/recurring_application_charges/654381179/activate.json", 'widget_store/charges/activate_recurring_application_charge')
|
92
92
|
|
93
93
|
@current_subscription.active_charge.destroy
|
94
|
-
get
|
94
|
+
get :activate, params: { subscription_id: @current_subscription, id: @new_charge.id, charge_id: @new_charge.shopify_id }
|
95
95
|
assert_equal @new_charge, @current_subscription.active_charge
|
96
96
|
assert_redirected_to Rails.application.routes.url_helpers.root_path
|
97
97
|
end
|
@@ -39,27 +39,27 @@ class DiscoApp::SubscriptionsControllerTest < ActionController::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
test 'logged-in, installed user with current subscription can create new subscription' do
|
42
|
-
post
|
42
|
+
post :create, params: { subscription: { plan: disco_app_plans(:premium) } }
|
43
43
|
assert_redirected_to Rails.application.routes.url_helpers.root_path
|
44
44
|
assert_equal disco_app_plans(:premium), @shop.current_plan
|
45
45
|
end
|
46
46
|
|
47
47
|
test 'logged-in, installed user with no subscription can create new subscription for available plan' do
|
48
48
|
@current_subscription.destroy
|
49
|
-
post
|
49
|
+
post :create, params: { subscription: { plan: disco_app_plans(:premium) } }
|
50
50
|
assert_redirected_to Rails.application.routes.url_helpers.root_path
|
51
51
|
assert_equal disco_app_plans(:premium), @shop.current_plan
|
52
52
|
end
|
53
53
|
|
54
54
|
test 'logged-in, installed user with current subscription can not create new subscription for unavailable plan' do
|
55
|
-
post
|
55
|
+
post :create, params: { subscription: { plan: disco_app_plans(:cheapo) } }
|
56
56
|
assert_redirected_to DiscoApp::Engine.routes.url_helpers.new_subscription_path
|
57
57
|
assert_equal @current_subscription, @shop.current_subscription
|
58
58
|
end
|
59
59
|
|
60
60
|
test 'logged-in, installed user with current subscription can create new subscription with valid cookied plan code' do
|
61
61
|
@request.cookies[DiscoApp::CODE_COOKIE_KEY] = 'PODCAST'
|
62
|
-
post
|
62
|
+
post :create, params: { subscription: { plan: disco_app_plans(:premium) } }
|
63
63
|
assert_redirected_to Rails.application.routes.url_helpers.root_path
|
64
64
|
assert_equal disco_app_plans(:premium), @shop.current_plan
|
65
65
|
assert_equal 8999, @shop.current_subscription.amount
|
@@ -14,7 +14,7 @@ class DiscoApp::WebhooksControllerTest < ActionController::TestCase
|
|
14
14
|
|
15
15
|
test 'webhook request without authentication information returns unauthorized' do
|
16
16
|
body = webhook_fixture('app_uninstalled')
|
17
|
-
post
|
17
|
+
post :process_webhook, body: body
|
18
18
|
assert_response :unauthorized
|
19
19
|
end
|
20
20
|
|
@@ -22,7 +22,7 @@ class DiscoApp::WebhooksControllerTest < ActionController::TestCase
|
|
22
22
|
body = webhook_fixture('app_uninstalled')
|
23
23
|
@request.headers['HTTP_X_SHOPIFY_TOPIC'] = :'app/uninstalled'
|
24
24
|
@request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN'] = @shop.shopify_domain
|
25
|
-
post
|
25
|
+
post :process_webhook, body: body
|
26
26
|
assert_response :unauthorized
|
27
27
|
end
|
28
28
|
|
@@ -31,7 +31,7 @@ class DiscoApp::WebhooksControllerTest < ActionController::TestCase
|
|
31
31
|
@request.headers['HTTP_X_SHOPIFY_TOPIC'] = :'app/uninstalled'
|
32
32
|
@request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN'] = @shop.shopify_domain
|
33
33
|
@request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = '0000'
|
34
|
-
post
|
34
|
+
post :process_webhook, body: body
|
35
35
|
assert_response :unauthorized
|
36
36
|
end
|
37
37
|
|
@@ -40,7 +40,7 @@ class DiscoApp::WebhooksControllerTest < ActionController::TestCase
|
|
40
40
|
@request.headers['HTTP_X_SHOPIFY_TOPIC'] = :'app/uninstalled'
|
41
41
|
@request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN'] = @shop.shopify_domain
|
42
42
|
@request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = DiscoApp::WebhookService.calculated_hmac(body, ShopifyApp.configuration.secret)
|
43
|
-
post
|
43
|
+
post :process_webhook, body: body
|
44
44
|
assert_response :ok
|
45
45
|
end
|
46
46
|
|
@@ -51,7 +51,7 @@ class DiscoApp::WebhooksControllerTest < ActionController::TestCase
|
|
51
51
|
@request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = DiscoApp::WebhookService.calculated_hmac(body, ShopifyApp.configuration.secret)
|
52
52
|
|
53
53
|
assert_enqueued_with(job: DiscoApp::AppUninstalledJob) do
|
54
|
-
post
|
54
|
+
post :process_webhook, body: body
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -93,7 +93,7 @@ class HomeControllerTest < ActionController::TestCase
|
|
93
93
|
log_out
|
94
94
|
Timecop.freeze('2017-03-08 12:44:58 +1100') do
|
95
95
|
hmac = 'eb49ba93a8daf8a11a04c66129faf98de1cd40f082b0ae78e79a2dfbbefb438d'
|
96
|
-
get
|
96
|
+
get :index, params: { hmac: hmac, shop: 'widgets-dev.myshopify.com', timestamp: Time.now.to_i }
|
97
97
|
assert_response :success
|
98
98
|
end
|
99
99
|
end
|
@@ -18,18 +18,18 @@ class ProxyControllerTest < ActionController::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
test 'app proxy request with incorrect authentication information returns unauthorized' do
|
21
|
-
get
|
21
|
+
get :index, params: proxy_params(shop: @shop.shopify_domain).merge(signature: 'invalid_signature')
|
22
22
|
assert_response :unauthorized
|
23
23
|
end
|
24
24
|
|
25
25
|
test 'app proxy request with correct authentication information returns ok and has shop context' do
|
26
|
-
get
|
26
|
+
get :index, params: proxy_params(shop: @shop.shopify_domain)
|
27
27
|
assert_response :ok
|
28
28
|
assert_equal @shop, assigns(:shop)
|
29
29
|
end
|
30
30
|
|
31
31
|
test 'app proxy request with correct authentication information but unknown shop returns 404' do
|
32
|
-
get
|
32
|
+
get :index, params: proxy_params(shop: 'unknown.myshopify.com')
|
33
33
|
assert_response :not_found
|
34
34
|
end
|
35
35
|
|
@@ -30,9 +30,6 @@ module Dummy
|
|
30
30
|
|
31
31
|
# Explicitly prevent real charges being created by default
|
32
32
|
config.x.shopify_charges_real = false
|
33
|
-
|
34
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
35
|
-
config.active_record.raise_in_transactional_callbacks = true
|
36
33
|
end
|
37
34
|
end
|
38
35
|
|
@@ -13,8 +13,8 @@ Rails.application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure static file server for tests with Cache-Control for performance.
|
16
|
-
config.
|
17
|
-
config.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
20
20
|
config.consider_all_requests_local = true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if Rails.configuration.cache_classes
|
2
2
|
ShopifyApp::SessionRepository.storage = DiscoApp::SessionStorage
|
3
3
|
else
|
4
|
-
|
4
|
+
ActiveSupport::Reloader.to_prepare do
|
5
5
|
ShopifyApp::SessionRepository.storage = DiscoApp::SessionStorage
|
6
6
|
end
|
7
7
|
end
|