disco_app 0.12.7.pre.puma.pre.3 → 0.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +1 -5
- data/app/assets/components/disco_app/forms/model-form.es6.jsx +2 -7
- data/app/assets/images/disco_app/.keep +0 -0
- data/app/assets/images/disco_app/logo.png +0 -0
- data/app/assets/javascripts/disco_app/components/custom/shop_row.js.jsx +2 -1
- data/app/assets/javascripts/disco_app/components/ui-kit/forms/base_form.es6.jsx +16 -44
- data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-checkbox.es6.jsx +10 -5
- data/app/clients/disco_app/api_client.rb +25 -19
- data/app/clients/disco_app/graphql_client.rb +85 -0
- data/app/controllers/disco_app/admin/app_settings_controller.rb +2 -0
- data/app/controllers/disco_app/admin/application_controller.rb +3 -1
- data/app/controllers/disco_app/admin/concerns/app_settings_controller.rb +2 -1
- data/app/controllers/disco_app/admin/concerns/authenticated_controller.rb +5 -3
- data/app/controllers/disco_app/admin/concerns/plans_controller.rb +3 -2
- data/app/controllers/disco_app/admin/concerns/shops_controller.rb +1 -0
- data/app/controllers/disco_app/admin/concerns/sources_controller.rb +52 -0
- data/app/controllers/disco_app/admin/concerns/subscriptions_controller.rb +3 -2
- data/app/controllers/disco_app/admin/plans_controller.rb +2 -0
- data/app/controllers/disco_app/admin/resources/shops_controller.rb +2 -0
- data/app/controllers/disco_app/admin/shops_controller.rb +2 -0
- data/app/controllers/disco_app/admin/sources_controller.rb +5 -0
- data/app/controllers/disco_app/admin/subscriptions_controller.rb +2 -0
- data/app/controllers/disco_app/charges_controller.rb +12 -8
- data/app/controllers/disco_app/concerns/app_proxy_controller.rb +6 -6
- data/app/controllers/disco_app/concerns/authenticated_controller.rb +31 -23
- data/app/controllers/disco_app/concerns/carrier_request_controller.rb +22 -11
- data/app/controllers/disco_app/concerns/user_authenticated_controller.rb +18 -0
- data/app/controllers/disco_app/concerns/webhooks_controller.rb +49 -0
- data/app/controllers/disco_app/flow/actions_controller.rb +9 -0
- data/app/controllers/disco_app/flow/concerns/actions_controller.rb +23 -0
- data/app/controllers/disco_app/flow/concerns/trigger_usage_controller.rb +29 -0
- data/app/controllers/disco_app/flow/concerns/verifies_flow_payload.rb +39 -0
- data/app/controllers/disco_app/flow/trigger_usage_controller.rb +9 -0
- data/app/controllers/disco_app/frame_controller.rb +0 -1
- data/app/controllers/disco_app/install_controller.rb +3 -6
- data/app/controllers/disco_app/subscriptions_controller.rb +12 -4
- data/app/controllers/disco_app/user_sessions_controller.rb +58 -0
- data/app/controllers/disco_app/webhooks_controller.rb +2 -43
- data/app/controllers/sessions_controller.rb +5 -6
- data/app/helpers/disco_app/application_helper.rb +7 -7
- data/app/jobs/application_job.rb +2 -0
- data/app/jobs/disco_app/app_installed_job.rb +2 -0
- data/app/jobs/disco_app/app_uninstalled_job.rb +2 -0
- data/app/jobs/disco_app/concerns/app_installed_job.rb +3 -4
- data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +2 -1
- data/app/jobs/disco_app/concerns/customers_data_request_job.rb +13 -0
- data/app/jobs/disco_app/concerns/customers_redact_job.rb +13 -0
- data/app/jobs/disco_app/concerns/render_asset_group_job.rb +2 -1
- data/app/jobs/disco_app/concerns/shop_redact_job.rb +13 -0
- data/app/jobs/disco_app/concerns/shop_update_job.rb +10 -3
- data/app/jobs/disco_app/concerns/subscription_changed_job.rb +2 -1
- data/app/jobs/disco_app/concerns/synchronise_carrier_service_job.rb +9 -8
- data/app/jobs/disco_app/concerns/synchronise_resources_job.rb +3 -6
- data/app/jobs/disco_app/concerns/synchronise_users_job.rb +18 -0
- data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +48 -18
- data/app/jobs/disco_app/customers_data_request_job.rb +5 -0
- data/app/jobs/disco_app/customers_redact_job.rb +5 -0
- data/app/jobs/disco_app/flow/process_action_job.rb +11 -0
- data/app/jobs/disco_app/flow/process_trigger_job.rb +11 -0
- data/app/jobs/disco_app/render_asset_group_job.rb +2 -0
- data/app/jobs/disco_app/send_subscription_job.rb +1 -1
- data/app/jobs/disco_app/shop_job.rb +12 -5
- data/app/jobs/disco_app/shop_redact_job.rb +5 -0
- data/app/jobs/disco_app/shop_update_job.rb +2 -0
- data/app/jobs/disco_app/subscription_changed_job.rb +2 -0
- data/app/jobs/disco_app/synchronise_carrier_service_job.rb +2 -0
- data/app/jobs/disco_app/synchronise_resources_job.rb +2 -0
- data/app/jobs/disco_app/synchronise_users_job.rb +5 -0
- data/app/jobs/disco_app/synchronise_webhooks_job.rb +2 -0
- data/app/models/application_record.rb +5 -0
- data/app/models/disco_app/app_settings.rb +3 -1
- data/app/models/disco_app/application_charge.rb +8 -2
- data/app/models/disco_app/concerns/app_settings.rb +2 -0
- data/app/models/disco_app/concerns/can_be_liquified.rb +34 -18
- data/app/models/disco_app/concerns/has_metafields.rb +100 -44
- data/app/models/disco_app/concerns/plan.rb +15 -7
- data/app/models/disco_app/concerns/plan_code.rb +5 -3
- data/app/models/disco_app/concerns/renders_assets.rb +15 -21
- data/app/models/disco_app/concerns/shop.rb +39 -16
- data/app/models/disco_app/concerns/source.rb +13 -0
- data/app/models/disco_app/concerns/subscription.rb +14 -7
- data/app/models/disco_app/concerns/synchronises.rb +16 -16
- data/app/models/disco_app/concerns/taggable.rb +8 -3
- data/app/models/disco_app/concerns/user.rb +21 -0
- data/app/models/disco_app/flow/action.rb +9 -0
- data/app/models/disco_app/flow/concerns/action.rb +27 -0
- data/app/models/disco_app/flow/concerns/trigger.rb +28 -0
- data/app/models/disco_app/flow/concerns/trigger_usage.rb +17 -0
- data/app/models/disco_app/flow/trigger.rb +9 -0
- data/app/models/disco_app/flow/trigger_usage.rb +9 -0
- data/app/models/disco_app/plan.rb +3 -1
- data/app/models/disco_app/plan_code.rb +3 -1
- data/app/models/disco_app/recurring_application_charge.rb +9 -2
- data/app/models/disco_app/session_storage.rb +5 -2
- data/app/models/disco_app/shop.rb +3 -1
- data/app/models/disco_app/source.rb +5 -0
- data/app/models/disco_app/subscription.rb +3 -1
- data/app/models/disco_app/user.rb +5 -0
- data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +16 -19
- data/app/resources/disco_app/admin/resources/shop_resource.rb +1 -0
- data/app/services/disco_app/carrier_request_service.rb +3 -3
- data/app/services/disco_app/charges_service.rb +28 -38
- data/app/services/disco_app/flow/create_action.rb +35 -0
- data/app/services/disco_app/flow/create_trigger.rb +34 -0
- data/app/services/disco_app/flow/process_action.rb +50 -0
- data/app/services/disco_app/flow/process_trigger.rb +72 -0
- data/app/services/disco_app/flow/update_trigger_usage.rb +42 -0
- data/app/services/disco_app/partner_app_service.rb +151 -0
- data/app/services/disco_app/proxy_service.rb +2 -2
- data/app/services/disco_app/request_validation_service.rb +2 -2
- data/app/services/disco_app/subscription_service.rb +62 -28
- data/app/services/disco_app/synchronise_resources_service.rb +54 -0
- data/app/services/disco_app/webhook_service.rb +9 -11
- data/app/views/disco_app/admin/sources/_form.html.erb +34 -0
- data/app/views/disco_app/admin/sources/edit.html.erb +7 -0
- data/app/views/disco_app/admin/sources/index.html.erb +32 -0
- data/app/views/disco_app/admin/sources/new.html.erb +7 -0
- data/app/views/disco_app/user_sessions/new.html.erb +12 -0
- data/app/views/layouts/admin/_nav_items.erb +7 -0
- data/app/views/layouts/admin.html.erb +1 -2
- data/app/views/layouts/application.html.erb +1 -2
- data/app/views/layouts/embedded_app.html.erb +2 -4
- data/app/views/layouts/embedded_app_modal.html.erb +2 -3
- data/app/views/shopify_app/sessions/new.html.erb +2 -4
- data/config/routes.rb +15 -3
- data/db/migrate/20150525000000_create_shops_if_not_existent.rb +81 -81
- data/db/migrate/20170315062548_create_disco_app_sources.rb +12 -0
- data/db/migrate/20170315062629_add_sources_to_shop_subscriptions.rb +16 -0
- data/db/migrate/20170327214540_create_disco_app_users.rb +14 -0
- data/db/migrate/20170606160751_fix_disco_app_users_index.rb +8 -0
- data/db/migrate/20181229100327_create_flow_actions_and_triggers.rb +32 -0
- data/db/migrate/20200405000000_create_flow_trigger_usages.rb +16 -0
- data/lib/disco_app/configuration.rb +12 -5
- data/lib/disco_app/constants.rb +4 -2
- data/lib/disco_app/engine.rb +1 -1
- data/lib/disco_app/session.rb +1 -0
- data/lib/disco_app/support/file_fixtures.rb +2 -1
- data/lib/disco_app/version.rb +3 -1
- data/lib/generators/disco_app/install/USAGE +5 -0
- data/lib/generators/disco_app/install/install_generator.rb +297 -0
- data/lib/generators/disco_app/{templates → install/templates}/assets/javascripts/application.js +0 -0
- data/lib/generators/disco_app/{templates → install/templates}/assets/javascripts/components.js +0 -0
- data/lib/generators/disco_app/{templates → install/templates}/assets/stylesheets/application.scss +0 -0
- data/lib/generators/disco_app/install/templates/config/appsignal.yml +12 -0
- data/lib/generators/disco_app/install/templates/config/cable.yml.tt +11 -0
- data/lib/generators/disco_app/{templates → install/templates}/config/database.yml.tt +7 -3
- data/lib/generators/disco_app/install/templates/config/environments/staging.rb +108 -0
- data/lib/generators/disco_app/{templates → install/templates}/config/puma.rb +0 -0
- data/lib/generators/disco_app/{templates → install/templates}/controllers/home_controller.rb +1 -0
- data/lib/generators/disco_app/{templates → install/templates}/initializers/disco_app.rb +5 -0
- data/lib/generators/disco_app/install/templates/initializers/session_store.rb +2 -0
- data/lib/generators/disco_app/install/templates/initializers/shopify_app.rb +11 -0
- data/lib/generators/disco_app/{templates → install/templates}/initializers/shopify_session_repository.rb +2 -1
- data/lib/generators/disco_app/install/templates/initializers/timber.rb +4 -0
- data/lib/generators/disco_app/install/templates/root/.editorconfig +9 -0
- data/lib/generators/disco_app/install/templates/root/.env +27 -0
- data/lib/generators/disco_app/install/templates/root/.env.local +29 -0
- data/lib/generators/disco_app/install/templates/root/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- data/lib/generators/disco_app/install/templates/root/.gitignore +65 -0
- data/lib/generators/disco_app/install/templates/root/.rspec +1 -0
- data/lib/generators/disco_app/install/templates/root/.rubocop.yml +758 -0
- data/lib/generators/disco_app/install/templates/root/.tool-versions +2 -0
- data/lib/generators/disco_app/{templates → install/templates}/root/CHECKS +0 -0
- data/lib/generators/disco_app/{templates → install/templates}/root/Procfile +0 -0
- data/lib/generators/disco_app/install/templates/root/README.md +26 -0
- data/lib/generators/disco_app/install/templates/root/package.json.tt +17 -0
- data/lib/generators/disco_app/install/templates/spec/rails_helper.rb +40 -0
- data/lib/generators/disco_app/install/templates/spec/spec_helper.rb +24 -0
- data/lib/generators/disco_app/install/templates/spec/support/active_job.rb +13 -0
- data/lib/generators/disco_app/install/templates/spec/support/coveralls.rb +3 -0
- data/lib/generators/disco_app/install/templates/spec/support/database_cleaner.rb +17 -0
- data/lib/generators/disco_app/install/templates/spec/support/factory_bot.rb +3 -0
- data/lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb +13 -0
- data/lib/generators/disco_app/install/templates/spec/support/shared_examples/a_synchronise_job.rb +12 -0
- data/lib/generators/disco_app/install/templates/spec/support/shoulda.rb +6 -0
- data/lib/generators/disco_app/install/templates/spec/support/vcr.rb +14 -0
- data/lib/generators/disco_app/install/templates/spec/support/webmock.rb +8 -0
- data/lib/generators/disco_app/{templates → install/templates}/views/home/index.html.erb +0 -0
- data/lib/generators/disco_app/react/USAGE +5 -0
- data/lib/generators/disco_app/react/react_generator.rb +108 -0
- data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/base_controller.rb +18 -0
- data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/home_controller.rb +10 -0
- data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/shops_controller.rb +11 -0
- data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/users_controller.rb +11 -0
- data/lib/generators/disco_app/react/templates/app/controllers/embedded/home_controller.rb +13 -0
- data/lib/generators/disco_app/react/templates/app/models/api_response.rb +107 -0
- data/lib/generators/disco_app/react/templates/app/serializers/disco_app/shop_serializer.rb +13 -0
- data/lib/generators/disco_app/react/templates/app/serializers/disco_app/user_serializer.rb +13 -0
- data/lib/generators/disco_app/react/templates/app/serializers/empty_serializer.rb +5 -0
- data/lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb +76 -0
- data/lib/generators/disco_app/react/templates/app/views/embedded/home/index.html.erb +12 -0
- data/lib/generators/disco_app/react/templates/app/views/layouts/embedded.html.erb +10 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/App.jsx +77 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/HomePage.jsx +34 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/EmbeddedPage.jsx +70 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/ErrorBanner.jsx +58 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/PaginationWrapper.jsx +10 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/ScrollToTop.jsx +23 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/withApi.jsx +125 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/index.jsx +39 -0
- data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js +19 -0
- data/lib/generators/disco_app/react/templates/app/webpack/packs/embedded.js +2 -0
- data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/banners.scss +7 -0
- data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/busy.scss +3 -0
- data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/index.scss +3 -0
- data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/pagination.scss +5 -0
- data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded.scss +2 -0
- data/lib/generators/disco_app/react/templates/config/initializers/mime_types.rb +13 -0
- data/lib/generators/disco_app/react/templates/config/initializers/omniauth.rb +27 -0
- data/lib/generators/disco_app/react/templates/config/initializers/version.rb.tt +7 -0
- data/lib/generators/disco_app/react/templates/config/webpack/staging.js +5 -0
- data/lib/generators/disco_app/react/templates/config/webpack/test.js +5 -0
- data/lib/generators/disco_app/react/templates/config/webpacker.yml +96 -0
- data/lib/generators/disco_app/react/templates/root/.eslintignore +5 -0
- data/lib/generators/disco_app/react/templates/root/.eslintrc +69 -0
- data/lib/generators/disco_app/react/templates/root/.prettierrc +3 -0
- data/lib/generators/disco_app/react/templates/root/VERSION +1 -0
- data/lib/generators/disco_app/react/templates/root/babel.config.js +72 -0
- data/lib/generators/disco_app/react/templates/root/package.json.tt +84 -0
- data/lib/generators/disco_app/react/templates/root/postcss.config.js +14 -0
- data/lib/tasks/api.rake +0 -2
- data/lib/tasks/carrier_service.rake +0 -2
- data/lib/tasks/database.rake +1 -1
- data/lib/tasks/partner_app.rake +26 -0
- data/lib/tasks/sessions.rake +0 -2
- data/lib/tasks/shops.rake +0 -2
- data/lib/tasks/users.rake +8 -0
- data/lib/tasks/webhooks.rake +0 -2
- data/test/clients/disco_app/api_client_test.rb +3 -3
- data/test/controllers/disco_app/admin/shops_controller_test.rb +1 -0
- data/test/controllers/disco_app/charges_controller_test.rb +19 -21
- data/test/controllers/disco_app/flow/trigger_usage_controller_test.rb +41 -0
- data/test/controllers/disco_app/install_controller_test.rb +2 -1
- data/test/controllers/disco_app/subscriptions_controller_test.rb +6 -5
- data/test/controllers/disco_app/webhooks_controller_test.rb +6 -5
- data/test/controllers/home_controller_test.rb +2 -2
- data/test/controllers/proxy_controller_test.rb +3 -3
- data/test/disco_app_test.rb +3 -1
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/config/manifest.js +2 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/carrier_request_controller.rb +1 -0
- data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +2 -1
- data/test/dummy/app/controllers/home_controller.rb +1 -0
- data/test/dummy/app/controllers/proxy_controller.rb +2 -1
- data/test/dummy/app/javascript/packs/application.js +18 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/jobs/carts_update_job.rb +1 -1
- data/test/dummy/app/jobs/disco_app/app_installed_job.rb +2 -3
- data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +3 -2
- data/test/dummy/app/jobs/products_create_job.rb +1 -1
- data/test/dummy/app/jobs/products_delete_job.rb +1 -1
- data/test/dummy/app/jobs/products_update_job.rb +1 -1
- data/test/dummy/app/models/application_record.rb +5 -0
- data/test/dummy/app/models/cart.rb +8 -7
- data/test/dummy/app/models/disco_app/shop.rb +8 -6
- data/test/dummy/app/models/js_configuration.rb +2 -1
- data/test/dummy/app/models/product.rb +4 -3
- data/test/dummy/app/models/widget_configuration.rb +2 -1
- data/test/dummy/babel.config.js +72 -0
- data/test/dummy/bin/bundle +1 -1
- data/test/dummy/bin/rails +1 -1
- data/test/dummy/bin/setup +8 -8
- data/test/dummy/bin/webpack +19 -0
- data/test/dummy/bin/webpack-dev-server +19 -0
- data/test/dummy/config/application.rb +3 -5
- data/test/dummy/config/boot.rb +2 -2
- data/test/dummy/config/database.yml +4 -0
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/staging.rb +85 -0
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/initializers/disco_app.rb +8 -1
- data/test/dummy/config/initializers/omniauth.rb +3 -4
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/initializers/shopify_app.rb +1 -0
- data/test/dummy/config/initializers/shopify_session_repository.rb +1 -1
- data/test/dummy/config/routes.rb +0 -2
- data/test/dummy/config/secrets.yml +3 -0
- data/test/dummy/config/webpack/development.js +5 -0
- data/test/dummy/config/webpack/environment.js +3 -0
- data/test/dummy/config/webpack/production.js +5 -0
- data/test/dummy/config/webpack/test.js +5 -0
- data/test/dummy/config/webpacker.yml +95 -0
- data/test/dummy/db/migrate/20160307182229_create_products.rb +3 -1
- data/test/dummy/db/migrate/20160530160739_create_asset_models.rb +3 -1
- data/test/dummy/db/migrate/20161105054746_create_carts.rb +3 -1
- data/test/dummy/db/schema.rb +141 -88
- data/test/dummy/package.json +10 -0
- data/test/dummy/postcss.config.js +12 -0
- data/test/dummy/yarn.lock +7278 -0
- data/test/fixtures/api/subscriptions/valid_request.json +2 -2
- data/test/fixtures/api/widget_store/charges/{activate_application_charge_request.json → get_active_application_charge_response.json} +1 -1
- data/test/fixtures/api/widget_store/charges/{activate_recurring_application_charge_request.json → get_active_recurring_application_charge_response.json} +2 -2
- data/test/fixtures/api/widget_store/empty_webhooks.json +3 -0
- data/test/fixtures/api/widget_store/existing_webhooks.json +43 -0
- data/test/fixtures/api/widget_store/products/get_metafields_empty_response.json +3 -0
- data/test/fixtures/api/widget_store/products/get_metafields_with_existing_response.json +11 -0
- data/test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json +4 -0
- data/test/fixtures/api/widget_store/products/write_metafields_single_namespace_request.json +2 -0
- data/test/fixtures/api/widget_store/products/write_metafields_with_existing_single_namespace_request.json +21 -0
- data/test/fixtures/api/widget_store/{charges/activate_application_charge_response.json → products/write_metafields_with_existing_single_namespace_response.json} +0 -0
- data/test/fixtures/api/widget_store/shops/get_metafields_with_existing_response.json +11 -0
- data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_first_request.json +9 -0
- data/test/fixtures/api/widget_store/{charges/activate_recurring_application_charge_response.json → shops/write_metafields_with_existing_first_response.json} +0 -0
- data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_request.json +9 -0
- data/test/fixtures/api/widget_store/shops/write_metafields_with_existing_second_response.json +1 -0
- data/test/fixtures/api/widget_store/users.json +42 -0
- data/test/fixtures/disco_app/shops.yml +9 -2
- data/test/fixtures/disco_app/sources.yml +3 -0
- data/test/fixtures/liquid/model.liquid +8 -8
- data/test/fixtures/webhooks/flow/trigger_usage.json +7 -0
- data/test/integration/synchronises_test.rb +20 -13
- data/test/jobs/disco_app/app_installed_job_test.rb +30 -11
- data/test/jobs/disco_app/app_uninstalled_job_test.rb +5 -2
- data/test/jobs/disco_app/send_subscription_job_test.rb +3 -2
- data/test/jobs/disco_app/synchronise_carrier_service_job_test.rb +1 -0
- data/test/jobs/disco_app/synchronise_users_job_test.rb +27 -0
- data/test/jobs/disco_app/synchronise_webhooks_job_test.rb +78 -9
- data/test/models/disco_app/can_be_liquified_test.rb +3 -1
- data/test/models/disco_app/has_metafields_test.rb +109 -20
- data/test/models/disco_app/renders_assets_test.rb +2 -1
- data/test/models/disco_app/session_test.rb +2 -2
- data/test/models/disco_app/shop_test.rb +1 -1
- data/test/services/disco_app/charges_service_test.rb +10 -14
- data/test/services/disco_app/flow/create_action_test.rb +51 -0
- data/test/services/disco_app/flow/create_trigger_test.rb +56 -0
- data/test/services/disco_app/flow/process_action_test.rb +68 -0
- data/test/services/disco_app/flow/process_trigger_test.rb +94 -0
- data/test/services/disco_app/flow/update_trigger_usage_test.rb +87 -0
- data/test/services/disco_app/subscription_service_test.rb +3 -2
- data/test/services/disco_app/synchronise_resources_service_test.rb +57 -0
- data/test/support/test_file_fixtures.rb +2 -2
- data/test/support/test_shopify_api.rb +1 -1
- data/test/test_helper.rb +24 -6
- data/test/vcr/flow_trigger_invalid_title.yml +35 -0
- data/test/vcr/flow_trigger_valid.yml +38 -0
- data/test/vcr/synchronise_products.yml +130 -0
- data/test/vcr/synchronise_products_paginated.yml +119 -0
- data/test/vcr/synchronise_products_since_id.yml +125 -0
- data/test/vcr/synchronise_products_with_params.yml +130 -0
- data/test/vcr/webhook_failure.yml +640 -0
- metadata +388 -142
- data/app/clients/disco_app/disco_api_error.rb +0 -2
- data/lib/generators/disco_app/USAGE +0 -5
- data/lib/generators/disco_app/disco_app_generator.rb +0 -236
- data/lib/generators/disco_app/templates/config/newrelic.yml +0 -26
- data/lib/generators/disco_app/templates/initializers/rollbar.rb +0 -23
- data/lib/generators/disco_app/templates/initializers/session_store.rb +0 -2
- data/lib/generators/disco_app/templates/initializers/shopify_app.rb +0 -6
- data/test/dummy/config/database.gitlab-ci.yml +0 -24
- data/test/fixtures/api/widget_store/charges/get_accepted_application_charge_response.json +0 -16
- data/test/fixtures/api/widget_store/charges/get_accepted_recurring_application_charge_response.json +0 -20
- data/test/fixtures/api/widget_store/webhooks.json +0 -1
@@ -9,7 +9,7 @@
|
|
9
9
|
"domain": null,
|
10
10
|
"plan_name": null,
|
11
11
|
"name": null,
|
12
|
-
"data": {"timezone": "(GMT+10:00) Melbourne", "country_name": "Australia"}
|
12
|
+
"data": {"timezone": "(GMT+10:00) Melbourne", "country_name": "Australia", "iana_timezone": "Australia/Melbourne"}
|
13
13
|
},
|
14
14
|
"subscription": {
|
15
15
|
"id": 304261385,
|
@@ -24,8 +24,8 @@
|
|
24
24
|
"cancelled_at": null,
|
25
25
|
"amount": 999,
|
26
26
|
"plan_code_id": null,
|
27
|
-
"source": null,
|
28
27
|
"trial_period_days": 14,
|
28
|
+
"source_id": null,
|
29
29
|
"active_charge": {
|
30
30
|
"id":332186283,
|
31
31
|
"shop_id":605094243,
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"name": "Lifetime",
|
5
5
|
"api_client_id": 755357713,
|
6
6
|
"price": "49.00",
|
7
|
-
"status": "
|
7
|
+
"status": "active",
|
8
8
|
"return_url": "https://test.example.com/subscriptions/304261385/charges/629961174/activate",
|
9
9
|
"created_at": "2015-09-02T14:52:56-04:00",
|
10
10
|
"updated_at": "2015-09-02T14:52:56-04:00",
|
@@ -4,13 +4,13 @@
|
|
4
4
|
"name": "Basic",
|
5
5
|
"api_client_id": 755357713,
|
6
6
|
"price": "9.99",
|
7
|
-
"status": "
|
7
|
+
"status": "active",
|
8
8
|
"return_url": "https://test.example.com/subscriptions/304261385/charges/629961174/activate",
|
9
9
|
"billing_on": null,
|
10
10
|
"created_at": "2015-09-02T14:50:32-04:00",
|
11
11
|
"updated_at": "2015-09-02T14:50:32-04:00",
|
12
12
|
"test": true,
|
13
|
-
"activated_on":
|
13
|
+
"activated_on": "2015-09-02T14:50:32-04:00",
|
14
14
|
"trial_ends_on": null,
|
15
15
|
"cancelled_on": null,
|
16
16
|
"trial_days": 14,
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"webhooks": [
|
3
|
+
{
|
4
|
+
"id": 748073353265,
|
5
|
+
"address": "https://test.example.com/webhooks",
|
6
|
+
"topic": "shop/update",
|
7
|
+
"created_at": "2020-04-01T00:00:00Z",
|
8
|
+
"updated_at": "2020-04-01T00:00:00Z",
|
9
|
+
"format": "json",
|
10
|
+
"fields": [],
|
11
|
+
"metafield_namespaces": [],
|
12
|
+
"api_version": "2020-04",
|
13
|
+
"private_metafield_namespaces": []
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": 748073353266,
|
17
|
+
"address": "https://old.example.com/webhooks",
|
18
|
+
"topic": "orders/create",
|
19
|
+
"created_at": "2020-04-01T00:00:00Z",
|
20
|
+
"updated_at": "2020-04-01T00:00:00Z",
|
21
|
+
"format": "json",
|
22
|
+
"fields": [],
|
23
|
+
"metafield_namespaces": [],
|
24
|
+
"api_version": "2020-04",
|
25
|
+
"private_metafield_namespaces": []
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"id": 748073353267,
|
29
|
+
"address": "https://test.example.com/webhooks",
|
30
|
+
"topic": "orders/paid",
|
31
|
+
"created_at": "2020-04-01T00:00:00Z",
|
32
|
+
"updated_at": "2020-04-01T00:00:00Z",
|
33
|
+
"format": "json",
|
34
|
+
"fields": [
|
35
|
+
"id",
|
36
|
+
"financial_status"
|
37
|
+
],
|
38
|
+
"metafield_namespaces": [],
|
39
|
+
"api_version": "2020-04",
|
40
|
+
"private_metafield_namespaces": []
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
data/test/fixtures/api/widget_store/products/write_metafields_multiple_namespaces_request.json
CHANGED
@@ -3,24 +3,28 @@
|
|
3
3
|
"id": 632910393,
|
4
4
|
"metafields": [
|
5
5
|
{
|
6
|
+
"id": null,
|
6
7
|
"namespace": "namespace1",
|
7
8
|
"key": "n1key1",
|
8
9
|
"value": "value1",
|
9
10
|
"value_type": "string"
|
10
11
|
},
|
11
12
|
{
|
13
|
+
"id": null,
|
12
14
|
"namespace": "namespace1",
|
13
15
|
"key": "n1key2",
|
14
16
|
"value": 2,
|
15
17
|
"value_type": "integer"
|
16
18
|
},
|
17
19
|
{
|
20
|
+
"id": null,
|
18
21
|
"namespace": "namespace2",
|
19
22
|
"key": "n2key3",
|
20
23
|
"value": "value3",
|
21
24
|
"value_type": "string"
|
22
25
|
},
|
23
26
|
{
|
27
|
+
"id": null,
|
24
28
|
"namespace": "namespace2",
|
25
29
|
"key": "n2key4",
|
26
30
|
"value": 2,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"product": {
|
3
|
+
"id": 632910393,
|
4
|
+
"metafields": [
|
5
|
+
{
|
6
|
+
"id": 874857827343,
|
7
|
+
"namespace": "namespace1",
|
8
|
+
"key": "key1",
|
9
|
+
"value": "value1",
|
10
|
+
"value_type": "string"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"id": null,
|
14
|
+
"namespace": "namespace1",
|
15
|
+
"key": "key2",
|
16
|
+
"value": "{\"json_key\":\"json_value\"}",
|
17
|
+
"value_type": "json_string"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
21
|
+
}
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"users": [
|
3
|
+
{
|
4
|
+
"id": 799407056,
|
5
|
+
"first_name": "Steve",
|
6
|
+
"email": "steve@apple.com",
|
7
|
+
"url": "www.apple.com",
|
8
|
+
"im": null,
|
9
|
+
"screen_name": null,
|
10
|
+
"phone": null,
|
11
|
+
"last_name": "Jobs",
|
12
|
+
"account_owner": true,
|
13
|
+
"receive_announcements": 1,
|
14
|
+
"bio": null,
|
15
|
+
"permissions": [
|
16
|
+
"full"
|
17
|
+
],
|
18
|
+
"user_type": "regular",
|
19
|
+
"phone_validated?": false,
|
20
|
+
"tfa_enabled?": false
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"id": 930143300,
|
24
|
+
"first_name": "noaccesssteve",
|
25
|
+
"email": "noaccesssteve@jobs.com",
|
26
|
+
"url": "www.apple.com",
|
27
|
+
"im": null,
|
28
|
+
"screen_name": null,
|
29
|
+
"phone": null,
|
30
|
+
"last_name": "Jobs",
|
31
|
+
"account_owner": false,
|
32
|
+
"receive_announcements": 1,
|
33
|
+
"bio": null,
|
34
|
+
"permissions": [
|
35
|
+
"limited"
|
36
|
+
],
|
37
|
+
"user_type": "regular",
|
38
|
+
"phone_validated?": false,
|
39
|
+
"tfa_enabled?": false
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
@@ -3,10 +3,17 @@ widget_store:
|
|
3
3
|
shopify_token: 00000000000000000000000000000000
|
4
4
|
created_at: "2017-03-07T06:06:25.000Z"
|
5
5
|
updated_at: "2017-03-07T06:06:25.000Z"
|
6
|
-
data:
|
6
|
+
data:
|
7
|
+
country_name: 'Australia'
|
8
|
+
timezone: '(GMT+10:00) Melbourne'
|
9
|
+
iana_timezone: 'Australia/Melbourne'
|
7
10
|
|
8
11
|
widget_store_dev:
|
9
12
|
shopify_domain: widgets-dev.myshopify.com
|
10
13
|
shopify_token: 00000000000000000000000000000000
|
11
14
|
status: 3
|
12
|
-
data:
|
15
|
+
data:
|
16
|
+
country_name: 'Sweden'
|
17
|
+
primary_locale: 'sv'
|
18
|
+
created_at: "2017-03-07T06:06:25.000Z"
|
19
|
+
updated_at: "2017-03-07T06:06:25.000Z"
|
@@ -1,8 +1,8 @@
|
|
1
|
-
{
|
2
|
-
{
|
3
|
-
{
|
4
|
-
{
|
5
|
-
{
|
6
|
-
{
|
7
|
-
{
|
8
|
-
{
|
1
|
+
{%- assign model_numeric = 42 -%}
|
2
|
+
{%- assign model_boolean = true -%}
|
3
|
+
{%- assign model_empty = nil -%}
|
4
|
+
{%- assign model_string = 'The cat's pyjamas are "great".' -%}
|
5
|
+
{%- assign model_string_html = 'The cat's pyjamas are <strong style="color: red;">great</strong>.' -%}
|
6
|
+
{%- assign model_array_of_numerics = '1@!@2@!@3' | split: '@!@' -%}
|
7
|
+
{%- assign model_array_of_strings = 'A@!@B@!@C' | split: '@!@' -%}
|
8
|
+
{%- assign model_hash = '{}' -%}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class SynchronisesTest < ActionDispatch::IntegrationTest
|
4
|
+
|
5
|
+
include ActiveJob::TestHelper
|
4
6
|
fixtures :all
|
5
7
|
|
6
8
|
def setup
|
@@ -14,31 +16,40 @@ class SynchronisesTest < ActionDispatch::IntegrationTest
|
|
14
16
|
end
|
15
17
|
|
16
18
|
test 'new product is created when product created webhook is received' do
|
17
|
-
|
19
|
+
perform_enqueued_jobs do
|
20
|
+
post_webhook('product_created', :'products/create')
|
21
|
+
end
|
18
22
|
|
19
23
|
# Assert the product was created locally, with the correct attributes.
|
20
24
|
product = Product.find(632910392)
|
21
|
-
assert_equal 'IPod Nano - 8GB', product.data[
|
25
|
+
assert_equal 'IPod Nano - 8GB', product.data[:title]
|
22
26
|
end
|
23
27
|
|
24
28
|
test 'existing product is updated when product updated webhook is received' do
|
25
29
|
assert_equal({}, @product.data)
|
26
30
|
|
27
|
-
|
31
|
+
perform_enqueued_jobs do
|
32
|
+
post_webhook('product_updated', :'products/update')
|
33
|
+
end
|
28
34
|
|
29
35
|
# Assert the product was updated locally, with the correct attributes.
|
30
36
|
@product.reload
|
31
37
|
assert_equal 632910393, @product.id
|
32
|
-
assert_equal 'IPod Nano - 8GB', @product.data[
|
38
|
+
assert_equal 'IPod Nano - 8GB', @product.data[:title]
|
33
39
|
end
|
34
40
|
|
35
41
|
test 'existing product is deleted when product deleted webhook is received' do
|
36
|
-
|
42
|
+
perform_enqueued_jobs do
|
43
|
+
post_webhook('product_deleted', :'products/delete')
|
44
|
+
end
|
45
|
+
|
37
46
|
assert_equal 0, Product.count
|
38
47
|
end
|
39
48
|
|
40
49
|
test 'cart with token for id is updated when cart updated webhook is received' do
|
41
|
-
|
50
|
+
perform_enqueued_jobs do
|
51
|
+
post_webhook('cart_updated', :'carts/update')
|
52
|
+
end
|
42
53
|
|
43
54
|
# Assert the cart data was correctly updated
|
44
55
|
assert_equal 3200.0, carts(:cart).total_price
|
@@ -47,13 +58,13 @@ class SynchronisesTest < ActionDispatch::IntegrationTest
|
|
47
58
|
test 'shopify api model still allows synchronisation' do
|
48
59
|
assert_equal({}, @product.data)
|
49
60
|
|
50
|
-
shopify_product = ShopifyAPI::Product.new(
|
61
|
+
shopify_product = ShopifyAPI::Product.new(JSON.parse(webhook_fixture('product_updated')))
|
51
62
|
Product.synchronise(@shop, shopify_product)
|
52
63
|
|
53
64
|
# Assert the product was updated locally, with the correct attributes.
|
54
65
|
@product.reload
|
55
66
|
assert_equal 632910393, @product.id
|
56
|
-
assert_equal 'IPod Nano - 8GB', @product.data[
|
67
|
+
assert_equal 'IPod Nano - 8GB', @product.data[:title]
|
57
68
|
end
|
58
69
|
|
59
70
|
private
|
@@ -64,11 +75,7 @@ class SynchronisesTest < ActionDispatch::IntegrationTest
|
|
64
75
|
|
65
76
|
def post_webhook(fixture_name, webhook_topic)
|
66
77
|
body = webhook_fixture(fixture_name)
|
67
|
-
post
|
68
|
-
HTTP_X_SHOPIFY_TOPIC: webhook_topic,
|
69
|
-
HTTP_X_SHOPIFY_SHOP_DOMAIN: @shop.shopify_domain,
|
70
|
-
HTTP_X_SHOPIFY_HMAC_SHA256: DiscoApp::WebhookService.calculated_hmac(body, ShopifyApp.configuration.secret)
|
71
|
-
})
|
78
|
+
post webhooks_url, params: body, headers: { HTTP_X_SHOPIFY_TOPIC: webhook_topic, HTTP_X_SHOPIFY_SHOP_DOMAIN: @shop.shopify_domain, HTTP_X_SHOPIFY_HMAC_SHA256: DiscoApp::WebhookService.calculated_hmac(body, ShopifyApp.configuration.secret) }
|
72
79
|
end
|
73
80
|
|
74
81
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class DiscoApp::AppInstalledJobTest < ActionController::TestCase
|
4
|
+
|
4
5
|
include ActiveJob::TestHelper
|
5
6
|
|
6
7
|
def setup
|
7
8
|
@shop = disco_app_shops(:widget_store)
|
8
9
|
|
9
|
-
stub_request(:get, "#{@shop.admin_url}/webhooks.json").to_return(status: 200, body: api_fixture('widget_store/
|
10
|
+
stub_request(:get, "#{@shop.admin_url}/webhooks.json").to_return(status: 200, body: api_fixture('widget_store/empty_webhooks').to_json)
|
10
11
|
stub_request(:post, "#{@shop.admin_url}/webhooks.json").to_return(status: 200)
|
11
12
|
stub_request(:get, "#{@shop.admin_url}/shop.json").to_return(status: 200, body: api_fixture('widget_store/shop').to_json)
|
12
13
|
stub_request(:get, "#{@shop.admin_url}/carrier_services.json").to_return(status: 200, body: api_fixture('widget_store/carrier_services').to_json)
|
13
14
|
stub_request(:post, "#{@shop.admin_url}/carrier_services.json").to_return(status: 200)
|
14
|
-
stub_request(:post,
|
15
|
+
stub_request(:post, 'https://api.discolabs.com/v1/app_subscriptions.json').to_return(status: 200)
|
15
16
|
end
|
16
17
|
|
17
18
|
def teardown
|
@@ -20,21 +21,25 @@ class DiscoApp::AppInstalledJobTest < ActionController::TestCase
|
|
20
21
|
end
|
21
22
|
|
22
23
|
test 'app installed job performs shop update job' do
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
with_suppressed_output do
|
25
|
+
# Assert the main install job can be enqueued and performed.
|
26
|
+
perform_enqueued_jobs do
|
27
|
+
DiscoApp::AppInstalledJob.perform_later(@shop)
|
28
|
+
end
|
26
29
|
end
|
27
30
|
|
28
31
|
# Assert the update shop job was performed.
|
29
32
|
@shop.reload
|
30
|
-
assert_equal 'United States', @shop.data[
|
33
|
+
assert_equal 'United States', @shop.data[:country_name]
|
31
34
|
end
|
32
35
|
|
33
36
|
test 'app installed job automatically subscribes stores to the correct default plan' do
|
34
37
|
@shop.current_subscription.destroy
|
35
38
|
|
36
|
-
|
37
|
-
|
39
|
+
with_suppressed_output do
|
40
|
+
perform_enqueued_jobs do
|
41
|
+
DiscoApp::AppInstalledJob.perform_later(@shop)
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
# Assert the shop was subscribed to the development plan.
|
@@ -44,14 +49,28 @@ class DiscoApp::AppInstalledJobTest < ActionController::TestCase
|
|
44
49
|
test 'app installed job automatically subscribes stores to the correct default plan with a plan code and a source' do
|
45
50
|
@shop.current_subscription.destroy
|
46
51
|
|
47
|
-
|
48
|
-
|
52
|
+
with_suppressed_output do
|
53
|
+
perform_enqueued_jobs do
|
54
|
+
DiscoApp::AppInstalledJob.perform_later(@shop, 'PODCAST', 'smp')
|
55
|
+
end
|
49
56
|
end
|
50
57
|
|
51
58
|
# Assert the shop was subscribed to the development plan.
|
52
59
|
assert_equal disco_app_plans(:development), @shop.current_subscription.plan
|
53
60
|
assert_equal disco_app_plan_codes(:podcast_dev), @shop.current_subscription.plan_code
|
54
|
-
assert_equal 'smpodcast', @shop.current_subscription.source
|
61
|
+
assert_equal 'smpodcast', @shop.current_subscription.source.name
|
55
62
|
end
|
56
63
|
|
64
|
+
private
|
65
|
+
|
66
|
+
# Prevents the output from the webhook synchronisation from
|
67
|
+
# printing to STDOUT and messing up the test output
|
68
|
+
def with_suppressed_output
|
69
|
+
original_stdout = $stdout.clone
|
70
|
+
$stdout.reopen(File.new('/dev/null', 'w'))
|
71
|
+
yield
|
72
|
+
ensure
|
73
|
+
$stdout.reopen(original_stdout)
|
74
|
+
end
|
75
|
+
|
57
76
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class DiscoApp::AppUninstalledJobTest < ActionController::TestCase
|
4
|
+
|
4
5
|
include ActiveJob::TestHelper
|
5
6
|
|
6
7
|
def setup
|
7
8
|
@shop = disco_app_shops(:widget_store)
|
8
|
-
stub_request(:post,
|
9
|
+
stub_request(:post, 'https://api.discolabs.com/v1/app_subscriptions.json').to_return(status: 200)
|
9
10
|
perform_enqueued_jobs do
|
10
11
|
DiscoApp::AppUninstalledJob.perform_later(@shop, {})
|
11
12
|
end
|
@@ -25,6 +26,8 @@ class DiscoApp::AppUninstalledJobTest < ActionController::TestCase
|
|
25
26
|
test 'app uninstalled job can be extended using concerns' do
|
26
27
|
assert_performed_jobs 2
|
27
28
|
@shop.reload
|
28
|
-
|
29
|
+
# Assert extended method called.
|
30
|
+
assert_equal 'Nowhere', @shop.data[:country_name]
|
29
31
|
end
|
32
|
+
|
30
33
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class DiscoApp::SendSubscriptionJobTest < ActionController::TestCase
|
4
|
+
|
4
5
|
include ActiveJob::TestHelper
|
5
6
|
|
6
7
|
def setup
|
7
8
|
@shop = disco_app_shops(:widget_store)
|
8
|
-
stub_request(:post,
|
9
|
+
stub_request(:post, 'https://api.discolabs.com/v1/app_subscriptions.json').to_return(status: 200)
|
9
10
|
end
|
10
11
|
|
11
12
|
def teardown
|
@@ -18,7 +19,7 @@ class DiscoApp::SendSubscriptionJobTest < ActionController::TestCase
|
|
18
19
|
perform_enqueued_jobs do
|
19
20
|
DiscoApp::SendSubscriptionJob.perform_later(@shop)
|
20
21
|
end
|
21
|
-
assert_requested(:post,
|
22
|
+
assert_requested(:post, 'https://api.discolabs.com/v1/app_subscriptions.json', times: 1)
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DiscoApp::SynchroniseUsersJobTest < ActionController::TestCase
|
4
|
+
|
5
|
+
include ActiveJob::TestHelper
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@shop = disco_app_shops(:widget_store)
|
9
|
+
stub_request(:get, "#{@shop.admin_url}/users.json").to_return(status: 200, body: api_fixture('widget_store/users').to_json)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
@shop = nil
|
14
|
+
WebMock.reset!
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'Successfully synchronise users via background job' do
|
18
|
+
perform_enqueued_jobs do
|
19
|
+
DiscoApp::SynchroniseUsersJob.perform_later(@shop)
|
20
|
+
end
|
21
|
+
user = DiscoApp::User.first
|
22
|
+
assert_equal 'Steve', user.first_name
|
23
|
+
assert_equal 'Jobs', user.last_name
|
24
|
+
assert_equal 'steve@apple.com', user.email
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|