workarea 3.4.16 → 3.4.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +81 -0
- metadata +10 -579
- data/docs/Gemfile +0 -8
- data/docs/Gemfile.lock +0 -130
- data/docs/bin/middleman +0 -29
- data/docs/config.rb +0 -87
- data/docs/config.ru +0 -7
- data/docs/data/articles.yml +0 -157
- data/docs/package.json +0 -15
- data/docs/source/404.html.erb +0 -13
- data/docs/source/articles/access-routes-in-javascript.html.md +0 -33
- data/docs/source/articles/add-a-content-area.html.md +0 -169
- data/docs/source/articles/add-a-content-block-type.html.md +0 -334
- data/docs/source/articles/add-a-report.html.md +0 -202
- data/docs/source/articles/add-css-through-the-admin-ui.html.md +0 -30
- data/docs/source/articles/add-javascript-through-a-manifest.html.md +0 -367
- data/docs/source/articles/add-javascript-through-a-view.html.md +0 -80
- data/docs/source/articles/add-javascript-through-the-admin-ui.html.md +0 -30
- data/docs/source/articles/add-metrics.html.md +0 -58
- data/docs/source/articles/add-or-replace-a-pricing-calculator.html.md +0 -150
- data/docs/source/articles/add-remove-or-change-a-mongoid-validation.html.md +0 -147
- data/docs/source/articles/add-remove-or-change-a-product-template.html.md +0 -142
- data/docs/source/articles/add-remove-sort-and-group-storefront-search-filters.html.md +0 -483
- data/docs/source/articles/add-stylesheets-through-a-manifest.html.md +0 -276
- data/docs/source/articles/add-system-content.html.md +0 -138
- data/docs/source/articles/analytics-overview.html.md +0 -51
- data/docs/source/articles/analyze-storefront-search-results.html.md +0 -261
- data/docs/source/articles/api-overview.html.md +0 -35
- data/docs/source/articles/appending.html.md +0 -506
- data/docs/source/articles/application-document.html.md +0 -88
- data/docs/source/articles/automated-javascript-testing.html.md +0 -162
- data/docs/source/articles/b2b-overview.html.md +0 -64
- data/docs/source/articles/browser-and-device-support.html.md +0 -47
- data/docs/source/articles/change-product-placeholder-image.html.md +0 -39
- data/docs/source/articles/change-storefront-search-results.html.md +0 -283
- data/docs/source/articles/change-the-storefront-product-pricing-ui.html.md +0 -348
- data/docs/source/articles/change-the-storefront-search-filters-ui.html.md +0 -103
- data/docs/source/articles/checkout.html.md +0 -479
- data/docs/source/articles/commerce-model.html.md +0 -164
- data/docs/source/articles/configuration-for-hosting.html.md +0 -106
- data/docs/source/articles/configuration.html.md +0 -406
- data/docs/source/articles/configure-a-payment-gateway.html.md +0 -58
- data/docs/source/articles/configure-asset-storage.html.md +0 -29
- data/docs/source/articles/configure-asset-types.html.md +0 -18
- data/docs/source/articles/configure-contact-form-subjects-list.html.md +0 -24
- data/docs/source/articles/configure-imageoptim.html.md +0 -23
- data/docs/source/articles/configure-locales.html.md +0 -45
- data/docs/source/articles/configure-logins-and-authentication.html.md +0 -42
- data/docs/source/articles/configure-low-inventory-threshold.html.md +0 -26
- data/docs/source/articles/configure-product-image-sizes-and-processing.html.md +0 -28
- data/docs/source/articles/content.html.md +0 -554
- data/docs/source/articles/contentable.html.md +0 -41
- data/docs/source/articles/contribute-code.html.md +0 -69
- data/docs/source/articles/contribute-documentation.html.md +0 -60
- data/docs/source/articles/create-a-custom-discount.html.md +0 -234
- data/docs/source/articles/create-a-new-app.html.md +0 -131
- data/docs/source/articles/create-a-plugin.html.md +0 -19
- data/docs/source/articles/create-a-style-guide.html.md +0 -71
- data/docs/source/articles/create-a-theme.html.md +0 -134
- data/docs/source/articles/css-architectural-overview.html.md +0 -89
- data/docs/source/articles/customize-a-helper.html.md +0 -91
- data/docs/source/articles/decoration.html.md +0 -415
- data/docs/source/articles/define-and-configure-inventory-policies.html.md +0 -107
- data/docs/source/articles/documentation-style-guide.html.md +0 -48
- data/docs/source/articles/documentation.html.md +0 -54
- data/docs/source/articles/domain-modeling.html.md +0 -82
- data/docs/source/articles/error-pages.html.md.erb +0 -95
- data/docs/source/articles/extension-overview.html.md +0 -152
- data/docs/source/articles/favicon-support.html.md +0 -112
- data/docs/source/articles/feature-spec-helper-stylesheet.html.md +0 -25
- data/docs/source/articles/featurejs-and-feature-spec-helper.html.md +0 -20
- data/docs/source/articles/help-and-support.html.md +0 -34
- data/docs/source/articles/html-fragment-caching.html.md +0 -46
- data/docs/source/articles/http-caching.html.md +0 -43
- data/docs/source/articles/i18n.html.md +0 -35
- data/docs/source/articles/images-flow.html.md +0 -10
- data/docs/source/articles/index-storefront-search-documents.html.md +0 -104
- data/docs/source/articles/infrastructure.html.md +0 -46
- data/docs/source/articles/installing.html.md +0 -61
- data/docs/source/articles/integrate-a-payment-gateway.html.md +0 -124
- data/docs/source/articles/integrate-a-web-analytics-provider.html.md +0 -35
- data/docs/source/articles/integrate-an-inventory-management-system.html.md +0 -88
- data/docs/source/articles/integrating-with-other-software.html.md +0 -59
- data/docs/source/articles/inventory.html.md +0 -352
- data/docs/source/articles/javascript-coding-standards.html.md +0 -30
- data/docs/source/articles/javascript-modules.html.md +0 -174
- data/docs/source/articles/javascript-overview.html.md +0 -62
- data/docs/source/articles/javascript-reference-documentation.html.md +0 -51
- data/docs/source/articles/javascript-templates.html.md +0 -52
- data/docs/source/articles/low-level-caching.html.md +0 -25
- data/docs/source/articles/maintain-a-plugin.html.md +0 -12
- data/docs/source/articles/maintenance-policy.html.md +0 -79
- data/docs/source/articles/navigable.html.md +0 -51
- data/docs/source/articles/navigating-the-code.html.md +0 -149
- data/docs/source/articles/navigation.html.md +0 -386
- data/docs/source/articles/order-life-cycle.html.md +0 -546
- data/docs/source/articles/order-pricing.html.md +0 -389
- data/docs/source/articles/orders-and-items.html.md +0 -210
- data/docs/source/articles/orders.html.md +0 -66
- data/docs/source/articles/overriding.html.md +0 -155
- data/docs/source/articles/overview.html.md +0 -43
- data/docs/source/articles/plugins-overview.html.md +0 -12
- data/docs/source/articles/prerequisites-and-dependencies.html.md +0 -202
- data/docs/source/articles/products.html.md.erb +0 -1270
- data/docs/source/articles/progressive-web-application-support.html.md +0 -148
- data/docs/source/articles/rails-asset-manifests.html.md +0 -33
- data/docs/source/articles/rails-asset-view-helpers.html.md +0 -25
- data/docs/source/articles/reading-data.html.md +0 -10
- data/docs/source/articles/releasable.html.md +0 -37
- data/docs/source/articles/report-a-bug.html.md +0 -75
- data/docs/source/articles/ruby-coding-standards.html.md +0 -10
- data/docs/source/articles/run-sidekiq-in-a-local-environment.html.md +0 -40
- data/docs/source/articles/searching.html.md +0 -1005
- data/docs/source/articles/security-policy.html.md +0 -42
- data/docs/source/articles/seeds.html.md +0 -345
- data/docs/source/articles/shipping.html.md +0 -756
- data/docs/source/articles/sort-and-exclude-product-options.html.md +0 -47
- data/docs/source/articles/storefront-search-features.html.md +0 -568
- data/docs/source/articles/storefront-searches.html.md +0 -126
- data/docs/source/articles/style-guides.html.md +0 -21
- data/docs/source/articles/stylesheet-coding-standards.html.md +0 -24
- data/docs/source/articles/stylesheets-overview.html.md +0 -67
- data/docs/source/articles/swappable-list-data-structure.html.md +0 -81
- data/docs/source/articles/system-emails.html.md +0 -102
- data/docs/source/articles/taggable.html.md +0 -8
- data/docs/source/articles/test-a-credit-card-transaction.html.md +0 -16
- data/docs/source/articles/test-if-a-plugin-is-installed.html.md +0 -34
- data/docs/source/articles/testing.html.md +0 -914
- data/docs/source/articles/themes-overview.html.md +0 -155
- data/docs/source/articles/translate-administrable-content.html.md +0 -14
- data/docs/source/articles/translate-javascript-content.html.md +0 -16
- data/docs/source/articles/translate-or-customize-message-content.html.md +0 -29
- data/docs/source/articles/translate-or-customize-static-content.html.md +0 -30
- data/docs/source/articles/use-an-existing-workarea-app.html.md +0 -108
- data/docs/source/articles/view-models.html.md +0 -509
- data/docs/source/articles/views.html.md +0 -14
- data/docs/source/articles/workers.html.md +0 -613
- data/docs/source/articles/writing-data.html.md +0 -10
- data/docs/source/cli.html.md +0 -163
- data/docs/source/favicon.ico +0 -0
- data/docs/source/images/3-variants-1-option.png +0 -0
- data/docs/source/images/3-variants-3-options.png +0 -0
- data/docs/source/images/3-years-primary-image.png +0 -0
- data/docs/source/images/404-storefront-error-page.png +0 -0
- data/docs/source/images/404-system-content-admin.png +0 -0
- data/docs/source/images/404.jpg +0 -0
- data/docs/source/images/5-years-primary-image.png +0 -0
- data/docs/source/images/activity-dashboard.png +0 -0
- data/docs/source/images/activity-for-object.png +0 -0
- data/docs/source/images/activity-ui.png +0 -0
- data/docs/source/images/adding-captioned-image-block-custom-icon.png +0 -0
- data/docs/source/images/adding-captioned-image-block-default-icon.png +0 -0
- data/docs/source/images/admin-alerts-ui.png +0 -0
- data/docs/source/images/admin-category-range-filters.png +0 -0
- data/docs/source/images/admin-for-3-column-hero.png +0 -0
- data/docs/source/images/admin-help-index.png +0 -0
- data/docs/source/images/admin-help-ui.png +0 -0
- data/docs/source/images/admin-javascript.png +0 -0
- data/docs/source/images/admin-notification-for-deactivated-discount.png +0 -0
- data/docs/source/images/admin-notifications-ui.png +0 -0
- data/docs/source/images/admin-product-show-page.png +0 -0
- data/docs/source/images/admin-products-index-page.png +0 -0
- data/docs/source/images/admin-range-filters.png +0 -0
- data/docs/source/images/admin-style-guides-navigation.png +0 -0
- data/docs/source/images/after-re-seeding.png +0 -0
- data/docs/source/images/after-seeding-localhost-3000.png +0 -0
- data/docs/source/images/after-seeding.png +0 -0
- data/docs/source/images/arrow.svg +0 -1
- data/docs/source/images/arrow_white.svg +0 -1
- data/docs/source/images/aws-resource-map.png +0 -0
- data/docs/source/images/backordered-until-output-on-inventory-sku-card.png +0 -0
- data/docs/source/images/before-seeding-localhost-3000.png +0 -0
- data/docs/source/images/before-seeding.png +0 -0
- data/docs/source/images/browsing-workarea-versions-on-the-web.png +0 -0
- data/docs/source/images/bulk-asset-upload-on-assets-index-page.png +0 -0
- data/docs/source/images/bulk-asset-upload-while-editing-content.png +0 -0
- data/docs/source/images/bundle-show-workarea-core.png +0 -0
- data/docs/source/images/bundle-show-workarea.png +0 -0
- data/docs/source/images/calendar-for-backordered-until-field.png +0 -0
- data/docs/source/images/captioned-image-block-in-storefront.png +0 -0
- data/docs/source/images/captioned-image-content-block-storefront-component-style-guide.png +0 -0
- data/docs/source/images/cart-system-content-in-admin.png +0 -0
- data/docs/source/images/cart-system-content-in-storefront.png +0 -0
- data/docs/source/images/checkout-addresses-guest.png +0 -0
- data/docs/source/images/checkout-addresses-user.png +0 -0
- data/docs/source/images/checkout-confirmation.png +0 -0
- data/docs/source/images/checkout-flow-0.png +0 -0
- data/docs/source/images/checkout-flow-1.png +0 -0
- data/docs/source/images/checkout-flow-2.png +0 -0
- data/docs/source/images/checkout-flow-3.png +0 -0
- data/docs/source/images/checkout-flow-4.png +0 -0
- data/docs/source/images/checkout-payment-guest.png +0 -0
- data/docs/source/images/checkout-payment-user.png +0 -0
- data/docs/source/images/checkout-shipping.png +0 -0
- data/docs/source/images/color-picker-component-admin-style-guide.png +0 -0
- data/docs/source/images/color-picker-component-on-content-editing-screen.png +0 -0
- data/docs/source/images/commerce-model-carts-orders.png +0 -0
- data/docs/source/images/commerce-model-order-pricing.png +0 -0
- data/docs/source/images/commerce-model.png +0 -0
- data/docs/source/images/configuring-an-index-pattern-in-kibana.png +0 -0
- data/docs/source/images/content-block-presets.png +0 -0
- data/docs/source/images/content-search-customization.png +0 -0
- data/docs/source/images/country-with-region-data-in-address-form.png +0 -0
- data/docs/source/images/country-without-region-data-in-address-form.png +0 -0
- data/docs/source/images/create-content-block-preset-ui.png +0 -0
- data/docs/source/images/credit-card-icons.png +0 -0
- data/docs/source/images/css-added-through-admin.png +0 -0
- data/docs/source/images/css-admin-ui.png +0 -0
- data/docs/source/images/current-configuration-shown-in-admin-settings.png +0 -0
- data/docs/source/images/customer-impersonation-in-admin.png +0 -0
- data/docs/source/images/customer-impersonation-in-store-front.png +0 -0
- data/docs/source/images/date-filter-same-day.png +0 -0
- data/docs/source/images/developer-toolbar-in-store-front.png +0 -0
- data/docs/source/images/discounts-sorted-by-most-redeemed.png +0 -0
- data/docs/source/images/edit-help-article.png +0 -0
- data/docs/source/images/editing-content-for-search-customization.png +0 -0
- data/docs/source/images/editing-dynamic-captioned-image-block.png +0 -0
- data/docs/source/images/editing-product-fields-in-the-admin.png +0 -0
- data/docs/source/images/editing-search-system-content.png +0 -0
- data/docs/source/images/editing-static-captioned-image-block-custom-icon.png +0 -0
- data/docs/source/images/editing-static-captioned-image-block-default-icon.png +0 -0
- data/docs/source/images/external.svg +0 -1
- data/docs/source/images/favicon_16.png +0 -0
- data/docs/source/images/favicon_180.png +0 -0
- data/docs/source/images/favicon_32.png +0 -0
- data/docs/source/images/filters-all.png +0 -0
- data/docs/source/images/filters-control.png +0 -0
- data/docs/source/images/filters-custom.png +0 -0
- data/docs/source/images/filters-groups.png +0 -0
- data/docs/source/images/filters-material.png +0 -0
- data/docs/source/images/filters-omitted.png +0 -0
- data/docs/source/images/filters-pinned.png +0 -0
- data/docs/source/images/filters-range.png +0 -0
- data/docs/source/images/filters-sorted.png +0 -0
- data/docs/source/images/filters-wrapping-to-second-line-in-admin.png +0 -0
- data/docs/source/images/generic-product-template-images-no-options-selected.png +0 -0
- data/docs/source/images/generic-product-template-images-options-selected.png +0 -0
- data/docs/source/images/generic-template.png +0 -0
- data/docs/source/images/hosting.svg +0 -1
- data/docs/source/images/image-group-content-block-in-storefront.png +0 -0
- data/docs/source/images/images.svg +0 -1
- data/docs/source/images/import-export-screenshot.png +0 -0
- data/docs/source/images/invalid-display.png +0 -0
- data/docs/source/images/itcss.png +0 -0
- data/docs/source/images/kibana-dev-tools-console.png +0 -0
- data/docs/source/images/layout-content-admin-with-2-areas.png +0 -0
- data/docs/source/images/layout-content-admin-with-3-areas.png +0 -0
- data/docs/source/images/link-to-search-system-content.png +0 -0
- data/docs/source/images/logo.svg +0 -1
- data/docs/source/images/menu.svg +0 -2
- data/docs/source/images/mongo-replica-set.svg +0 -1
- data/docs/source/images/multi-column-hero-blocks.png +0 -0
- data/docs/source/images/option-selects-product-template-images-options-selected.png +0 -0
- data/docs/source/images/option-selects-template.png +0 -0
- data/docs/source/images/option-thumbnails-template.png +0 -0
- data/docs/source/images/order-item-total-price-diagram.png +0 -0
- data/docs/source/images/order-pricing-cart-example.png +0 -0
- data/docs/source/images/order-pricing-example-adjustments.png +0 -0
- data/docs/source/images/order-pricing-example-totals.png +0 -0
- data/docs/source/images/order-pricing-placed-order-example.png +0 -0
- data/docs/source/images/order-shipping-total-diagram.png +0 -0
- data/docs/source/images/order-show-with-multiple-tenders.png +0 -0
- data/docs/source/images/order-subtotal-price-diagram.png +0 -0
- data/docs/source/images/order-tax-total-diagram.png +0 -0
- data/docs/source/images/order-total-price-diagram.png +0 -0
- data/docs/source/images/order-total-value-diagram.png +0 -0
- data/docs/source/images/orders-dashboard-links.png +0 -0
- data/docs/source/images/oval.svg +0 -1
- data/docs/source/images/payment-icon-storefront-style-guide.png +0 -0
- data/docs/source/images/people-dashboard-links.png +0 -0
- data/docs/source/images/price-adjustments-diagram.png +0 -0
- data/docs/source/images/price-display-no-options.png +0 -0
- data/docs/source/images/price-display-options-selected.png +0 -0
- data/docs/source/images/pricing-calculators-diagram.png +0 -0
- data/docs/source/images/product-list-content-block-admin.png +0 -0
- data/docs/source/images/product-list-content-block-in-store-front.png +0 -0
- data/docs/source/images/promo-products-excluded-autocomplete-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-featured-category-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-recommendations-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-search-category-results-after.png +0 -0
- data/docs/source/images/promo-products-excluded-search-results-after.png +0 -0
- data/docs/source/images/promo-products-included-autocomplete-results-before.png +0 -0
- data/docs/source/images/promo-products-included-featured-category-results-before.png +0 -0
- data/docs/source/images/promo-products-included-recommendations-results-before.png +0 -0
- data/docs/source/images/promo-products-included-search-category-results-before.png +0 -0
- data/docs/source/images/promo-products-included-search-results-before.png +0 -0
- data/docs/source/images/rails-version-constraint.png +0 -0
- data/docs/source/images/re-enable-discount.png +0 -0
- data/docs/source/images/reading-data.svg +0 -1
- data/docs/source/images/readme-hero.png +0 -0
- data/docs/source/images/redesigned-customized-sort-for-search-results.png +0 -0
- data/docs/source/images/reviews-summary-above-share-buttons.png +0 -0
- data/docs/source/images/reviews-summary-below-product-name.png +0 -0
- data/docs/source/images/reviews-summary-below-share-buttons.png +0 -0
- data/docs/source/images/reviews-summary-removed.png +0 -0
- data/docs/source/images/rsa-fingerprint-for-stash.png +0 -0
- data/docs/source/images/ruby-version-constraint.png +0 -0
- data/docs/source/images/script-tag-added-through-admin.png +0 -0
- data/docs/source/images/search-analysis-admin-alternate-rendering.png +0 -0
- data/docs/source/images/search-analysis-admin.png +0 -0
- data/docs/source/images/search-quality-report.png +0 -0
- data/docs/source/images/search.svg +0 -1
- data/docs/source/images/searching-for-cart-system-content-in-admin.png +0 -0
- data/docs/source/images/searching-for-layout-system-content-in-admin.png +0 -0
- data/docs/source/images/seeded-admin.png +0 -0
- data/docs/source/images/seeds-from-plugins.png +0 -0
- data/docs/source/images/seo-metadata-automation-ui.png +0 -0
- data/docs/source/images/show-password-button.png +0 -0
- data/docs/source/images/storefront-autocomplete.png +0 -0
- data/docs/source/images/storefront-category-summary-content-block.png +0 -0
- data/docs/source/images/storefront-category.png +0 -0
- data/docs/source/images/storefront-product-after-overriding.png +0 -0
- data/docs/source/images/storefront-product-before-overriding.png +0 -0
- data/docs/source/images/storefront-product-browse-page.png +0 -0
- data/docs/source/images/storefront-product-recommendations.png +0 -0
- data/docs/source/images/storefront-product-show-page.png +0 -0
- data/docs/source/images/storefront-requests-and-search-requests.png +0 -0
- data/docs/source/images/storefront-search-request-handling.png +0 -0
- data/docs/source/images/storefront-search-response-creation.png +0 -0
- data/docs/source/images/storefront-search.png +0 -0
- data/docs/source/images/storefront-style-guides-navigation.png +0 -0
- data/docs/source/images/styles.css +0 -3
- data/docs/source/images/tax-categories-ui.png +0 -0
- data/docs/source/images/tax-rates-ui.png +0 -0
- data/docs/source/images/unpurchasable-product.png +0 -0
- data/docs/source/images/url-redirects-filtering.png +0 -0
- data/docs/source/images/utility-nav-area-in-admin.png +0 -0
- data/docs/source/images/utility-nav-area-in-storefront.png +0 -0
- data/docs/source/images/validation-message-in-storefront.png +0 -0
- data/docs/source/images/view-model-interface.png +0 -0
- data/docs/source/images/viewing-workarea-version-in-source.png +0 -0
- data/docs/source/images/workarea.svg +0 -1
- data/docs/source/images/worst-performing-searches-on-results-customization-page.png +0 -0
- data/docs/source/images/writing-data.svg +0 -1
- data/docs/source/index.html.erb +0 -166
- data/docs/source/javascripts/jquery.js +0 -2
- data/docs/source/javascripts/lunr.js +0 -7
- data/docs/source/javascripts/site.js +0 -299
- data/docs/source/javascripts/vendor/highlight.pack.js +0 -2
- data/docs/source/layouts/article.erb +0 -106
- data/docs/source/layouts/bare.erb +0 -46
- data/docs/source/layouts/layout.erb +0 -43
- data/docs/source/release-notes/workarea-3-0-0.html.md +0 -146
- data/docs/source/release-notes/workarea-3-0-1.html.md +0 -161
- data/docs/source/release-notes/workarea-3-0-10.html.md +0 -39
- data/docs/source/release-notes/workarea-3-0-11.html.md +0 -277
- data/docs/source/release-notes/workarea-3-0-12.html.md +0 -14
- data/docs/source/release-notes/workarea-3-0-13.html.md +0 -153
- data/docs/source/release-notes/workarea-3-0-14.html.md +0 -93
- data/docs/source/release-notes/workarea-3-0-15.html.md +0 -107
- data/docs/source/release-notes/workarea-3-0-16.html.md +0 -36
- data/docs/source/release-notes/workarea-3-0-17.html.md +0 -141
- data/docs/source/release-notes/workarea-3-0-18.html.md +0 -123
- data/docs/source/release-notes/workarea-3-0-19.html.md +0 -160
- data/docs/source/release-notes/workarea-3-0-2.html.md +0 -222
- data/docs/source/release-notes/workarea-3-0-20.html.md +0 -95
- data/docs/source/release-notes/workarea-3-0-21.html.md +0 -168
- data/docs/source/release-notes/workarea-3-0-22.html.md +0 -268
- data/docs/source/release-notes/workarea-3-0-23.html.md +0 -173
- data/docs/source/release-notes/workarea-3-0-24.html.md +0 -19
- data/docs/source/release-notes/workarea-3-0-25.html.md +0 -26
- data/docs/source/release-notes/workarea-3-0-26.html.md +0 -199
- data/docs/source/release-notes/workarea-3-0-27.html.md +0 -113
- data/docs/source/release-notes/workarea-3-0-28.html.md +0 -39
- data/docs/source/release-notes/workarea-3-0-29.html.md +0 -73
- data/docs/source/release-notes/workarea-3-0-3.html.md +0 -35
- data/docs/source/release-notes/workarea-3-0-30.html.md +0 -186
- data/docs/source/release-notes/workarea-3-0-31.html.md +0 -125
- data/docs/source/release-notes/workarea-3-0-32.html.md +0 -73
- data/docs/source/release-notes/workarea-3-0-33.html.md +0 -137
- data/docs/source/release-notes/workarea-3-0-34.html.md +0 -203
- data/docs/source/release-notes/workarea-3-0-35.html.md +0 -205
- data/docs/source/release-notes/workarea-3-0-36.html.md +0 -105
- data/docs/source/release-notes/workarea-3-0-37.html.md +0 -144
- data/docs/source/release-notes/workarea-3-0-38.html.md +0 -73
- data/docs/source/release-notes/workarea-3-0-39.html.md +0 -77
- data/docs/source/release-notes/workarea-3-0-4.html.md +0 -14
- data/docs/source/release-notes/workarea-3-0-40.html.md +0 -130
- data/docs/source/release-notes/workarea-3-0-41.html.md +0 -70
- data/docs/source/release-notes/workarea-3-0-42.html.md +0 -52
- data/docs/source/release-notes/workarea-3-0-43.html.md +0 -72
- data/docs/source/release-notes/workarea-3-0-44.html.md +0 -93
- data/docs/source/release-notes/workarea-3-0-45.html.md +0 -61
- data/docs/source/release-notes/workarea-3-0-46.html.md +0 -171
- data/docs/source/release-notes/workarea-3-0-47.html.md +0 -130
- data/docs/source/release-notes/workarea-3-0-48.html.md +0 -160
- data/docs/source/release-notes/workarea-3-0-49.html.md +0 -28
- data/docs/source/release-notes/workarea-3-0-5.html.md +0 -225
- data/docs/source/release-notes/workarea-3-0-50.html.md +0 -74
- data/docs/source/release-notes/workarea-3-0-51.html.md +0 -61
- data/docs/source/release-notes/workarea-3-0-52.html.md +0 -76
- data/docs/source/release-notes/workarea-3-0-53.html.md +0 -126
- data/docs/source/release-notes/workarea-3-0-54.html.md +0 -112
- data/docs/source/release-notes/workarea-3-0-55.html.md +0 -105
- data/docs/source/release-notes/workarea-3-0-56.html.md +0 -56
- data/docs/source/release-notes/workarea-3-0-57.html.md +0 -82
- data/docs/source/release-notes/workarea-3-0-58.html.md +0 -153
- data/docs/source/release-notes/workarea-3-0-59.html.md +0 -78
- data/docs/source/release-notes/workarea-3-0-6.html.md +0 -165
- data/docs/source/release-notes/workarea-3-0-60.html.md +0 -43
- data/docs/source/release-notes/workarea-3-0-61.html.md +0 -46
- data/docs/source/release-notes/workarea-3-0-62.html.md +0 -23
- data/docs/source/release-notes/workarea-3-0-63.html.md +0 -25
- data/docs/source/release-notes/workarea-3-0-64.html.md +0 -25
- data/docs/source/release-notes/workarea-3-0-65.html.md +0 -37
- data/docs/source/release-notes/workarea-3-0-7.html.md +0 -207
- data/docs/source/release-notes/workarea-3-0-8.html.md +0 -337
- data/docs/source/release-notes/workarea-3-0-9.html.md +0 -196
- data/docs/source/release-notes/workarea-3-1-0.html.md +0 -414
- data/docs/source/release-notes/workarea-3-1-1.html.md +0 -139
- data/docs/source/release-notes/workarea-3-1-10.html.md +0 -19
- data/docs/source/release-notes/workarea-3-1-11.html.md +0 -27
- data/docs/source/release-notes/workarea-3-1-12.html.md +0 -216
- data/docs/source/release-notes/workarea-3-1-13.html.md +0 -113
- data/docs/source/release-notes/workarea-3-1-14.html.md +0 -39
- data/docs/source/release-notes/workarea-3-1-15.html.md +0 -107
- data/docs/source/release-notes/workarea-3-1-16.html.md +0 -188
- data/docs/source/release-notes/workarea-3-1-17.html.md +0 -141
- data/docs/source/release-notes/workarea-3-1-18.html.md +0 -73
- data/docs/source/release-notes/workarea-3-1-19.html.md +0 -137
- data/docs/source/release-notes/workarea-3-1-2.html.md +0 -55
- data/docs/source/release-notes/workarea-3-1-20.html.md +0 -203
- data/docs/source/release-notes/workarea-3-1-21.html.md +0 -205
- data/docs/source/release-notes/workarea-3-1-22.html.md +0 -121
- data/docs/source/release-notes/workarea-3-1-23.html.md +0 -144
- data/docs/source/release-notes/workarea-3-1-24.html.md +0 -94
- data/docs/source/release-notes/workarea-3-1-25.html.md +0 -77
- data/docs/source/release-notes/workarea-3-1-26.html.md +0 -130
- data/docs/source/release-notes/workarea-3-1-27.html.md +0 -70
- data/docs/source/release-notes/workarea-3-1-28.html.md +0 -52
- data/docs/source/release-notes/workarea-3-1-29.html.md +0 -44
- data/docs/source/release-notes/workarea-3-1-3.html.md +0 -185
- data/docs/source/release-notes/workarea-3-1-30.html.md +0 -72
- data/docs/source/release-notes/workarea-3-1-31.html.md +0 -93
- data/docs/source/release-notes/workarea-3-1-32.html.md +0 -61
- data/docs/source/release-notes/workarea-3-1-33.html.md +0 -171
- data/docs/source/release-notes/workarea-3-1-34.html.md +0 -130
- data/docs/source/release-notes/workarea-3-1-35.html.md +0 -179
- data/docs/source/release-notes/workarea-3-1-36.html.md +0 -28
- data/docs/source/release-notes/workarea-3-1-37.html.md +0 -74
- data/docs/source/release-notes/workarea-3-1-38.html.md +0 -61
- data/docs/source/release-notes/workarea-3-1-39.html.md +0 -96
- data/docs/source/release-notes/workarea-3-1-4.html.md +0 -148
- data/docs/source/release-notes/workarea-3-1-40.html.md +0 -126
- data/docs/source/release-notes/workarea-3-1-41.html.md +0 -128
- data/docs/source/release-notes/workarea-3-1-42.html.md +0 -105
- data/docs/source/release-notes/workarea-3-1-43.html.md +0 -37
- data/docs/source/release-notes/workarea-3-1-44.html.md +0 -82
- data/docs/source/release-notes/workarea-3-1-45.html.md +0 -153
- data/docs/source/release-notes/workarea-3-1-46.html.md +0 -91
- data/docs/source/release-notes/workarea-3-1-47.html.md +0 -65
- data/docs/source/release-notes/workarea-3-1-48.html.md +0 -46
- data/docs/source/release-notes/workarea-3-1-49.html.md +0 -23
- data/docs/source/release-notes/workarea-3-1-5.html.md +0 -169
- data/docs/source/release-notes/workarea-3-1-50.html.md +0 -42
- data/docs/source/release-notes/workarea-3-1-51.html.md +0 -25
- data/docs/source/release-notes/workarea-3-1-52.html.md +0 -57
- data/docs/source/release-notes/workarea-3-1-6.html.md +0 -117
- data/docs/source/release-notes/workarea-3-1-7.html.md +0 -176
- data/docs/source/release-notes/workarea-3-1-8.html.md +0 -283
- data/docs/source/release-notes/workarea-3-1-9.html.md +0 -212
- data/docs/source/release-notes/workarea-3-2-0.html.md +0 -1705
- data/docs/source/release-notes/workarea-3-2-1.html.md +0 -216
- data/docs/source/release-notes/workarea-3-2-10.html.md +0 -237
- data/docs/source/release-notes/workarea-3-2-11.html.md +0 -121
- data/docs/source/release-notes/workarea-3-2-12.html.md +0 -145
- data/docs/source/release-notes/workarea-3-2-13.html.md +0 -138
- data/docs/source/release-notes/workarea-3-2-14.html.md +0 -77
- data/docs/source/release-notes/workarea-3-2-15.html.md +0 -130
- data/docs/source/release-notes/workarea-3-2-16.html.md +0 -111
- data/docs/source/release-notes/workarea-3-2-17.html.md +0 -52
- data/docs/source/release-notes/workarea-3-2-18.html.md +0 -44
- data/docs/source/release-notes/workarea-3-2-19.html.md +0 -72
- data/docs/source/release-notes/workarea-3-2-2.html.md +0 -145
- data/docs/source/release-notes/workarea-3-2-20.html.md +0 -93
- data/docs/source/release-notes/workarea-3-2-21.html.md +0 -61
- data/docs/source/release-notes/workarea-3-2-22.html.md +0 -154
- data/docs/source/release-notes/workarea-3-2-23.html.md +0 -130
- data/docs/source/release-notes/workarea-3-2-24.html.md +0 -200
- data/docs/source/release-notes/workarea-3-2-25.html.md +0 -28
- data/docs/source/release-notes/workarea-3-2-26.html.md +0 -94
- data/docs/source/release-notes/workarea-3-2-27.html.md +0 -61
- data/docs/source/release-notes/workarea-3-2-28.html.md +0 -96
- data/docs/source/release-notes/workarea-3-2-29.html.md +0 -126
- data/docs/source/release-notes/workarea-3-2-30.html.md +0 -112
- data/docs/source/release-notes/workarea-3-2-31.html.md +0 -105
- data/docs/source/release-notes/workarea-3-2-32.html.md +0 -56
- data/docs/source/release-notes/workarea-3-2-33.html.md +0 -82
- data/docs/source/release-notes/workarea-3-2-34.html.md +0 -153
- data/docs/source/release-notes/workarea-3-2-35.html.md +0 -91
- data/docs/source/release-notes/workarea-3-2-36.html.md +0 -118
- data/docs/source/release-notes/workarea-3-2-37.html.md +0 -46
- data/docs/source/release-notes/workarea-3-2-38.html.md +0 -23
- data/docs/source/release-notes/workarea-3-2-39.html.md +0 -42
- data/docs/source/release-notes/workarea-3-2-4.html.md +0 -109
- data/docs/source/release-notes/workarea-3-2-40.html.md +0 -25
- data/docs/source/release-notes/workarea-3-2-41.html.md +0 -90
- data/docs/source/release-notes/workarea-3-2-5.html.md +0 -186
- data/docs/source/release-notes/workarea-3-2-6.html.md +0 -173
- data/docs/source/release-notes/workarea-3-2-7.html.md +0 -89
- data/docs/source/release-notes/workarea-3-2-8.html.md +0 -137
- data/docs/source/release-notes/workarea-3-2-9.html.md +0 -219
- data/docs/source/release-notes/workarea-3-3-0.html.md +0 -1272
- data/docs/source/release-notes/workarea-3-3-1.html.md +0 -324
- data/docs/source/release-notes/workarea-3-3-10.html.md +0 -69
- data/docs/source/release-notes/workarea-3-3-11.html.md +0 -72
- data/docs/source/release-notes/workarea-3-3-12.html.md +0 -136
- data/docs/source/release-notes/workarea-3-3-13.html.md +0 -61
- data/docs/source/release-notes/workarea-3-3-14.html.md +0 -196
- data/docs/source/release-notes/workarea-3-3-15.html.md +0 -167
- data/docs/source/release-notes/workarea-3-3-16.html.md +0 -234
- data/docs/source/release-notes/workarea-3-3-17.html.md +0 -82
- data/docs/source/release-notes/workarea-3-3-18.html.md +0 -165
- data/docs/source/release-notes/workarea-3-3-19.html.md +0 -106
- data/docs/source/release-notes/workarea-3-3-2.html.md +0 -72
- data/docs/source/release-notes/workarea-3-3-20.html.md +0 -116
- data/docs/source/release-notes/workarea-3-3-21.html.md +0 -228
- data/docs/source/release-notes/workarea-3-3-22.html.md +0 -125
- data/docs/source/release-notes/workarea-3-3-23.html.md +0 -154
- data/docs/source/release-notes/workarea-3-3-24.html.md +0 -70
- data/docs/source/release-notes/workarea-3-3-25.html.md +0 -114
- data/docs/source/release-notes/workarea-3-3-26.html.md +0 -260
- data/docs/source/release-notes/workarea-3-3-27.html.md +0 -138
- data/docs/source/release-notes/workarea-3-3-28.html.md +0 -147
- data/docs/source/release-notes/workarea-3-3-29.html.md +0 -63
- data/docs/source/release-notes/workarea-3-3-3.html.md +0 -153
- data/docs/source/release-notes/workarea-3-3-30.html.md +0 -102
- data/docs/source/release-notes/workarea-3-3-31.html.md +0 -57
- data/docs/source/release-notes/workarea-3-3-32.html.md +0 -44
- data/docs/source/release-notes/workarea-3-3-33.html.md +0 -114
- data/docs/source/release-notes/workarea-3-3-34.html.md +0 -29
- data/docs/source/release-notes/workarea-3-3-4.html.md +0 -332
- data/docs/source/release-notes/workarea-3-3-5.html.md +0 -242
- data/docs/source/release-notes/workarea-3-3-6.html.md +0 -100
- data/docs/source/release-notes/workarea-3-3-7.html.md +0 -148
- data/docs/source/release-notes/workarea-3-3-8.html.md +0 -163
- data/docs/source/release-notes/workarea-3-3-9.html.md +0 -93
- data/docs/source/release-notes/workarea-3-4-0.html.md +0 -580
- data/docs/source/release-notes/workarea-3-4-1.html.md +0 -150
- data/docs/source/release-notes/workarea-3-4-10.html.md +0 -72
- data/docs/source/release-notes/workarea-3-4-11.html.md +0 -60
- data/docs/source/release-notes/workarea-3-4-12.html.md +0 -155
- data/docs/source/release-notes/workarea-3-4-15.html.md +0 -100
- data/docs/source/release-notes/workarea-3-4-16.html.md +0 -88
- data/docs/source/release-notes/workarea-3-4-2.html.md +0 -188
- data/docs/source/release-notes/workarea-3-4-3.html.md +0 -136
- data/docs/source/release-notes/workarea-3-4-4.html.md +0 -114
- data/docs/source/release-notes/workarea-3-4-5.html.md +0 -275
- data/docs/source/release-notes/workarea-3-4-6.html.md +0 -169
- data/docs/source/release-notes/workarea-3-4-7.html.md +0 -162
- data/docs/source/release-notes/workarea-3-4-8.html.md +0 -95
- data/docs/source/release-notes/workarea-3-4-9.html.md +0 -135
- data/docs/source/release-notes.html.md +0 -261
- data/docs/source/search.html.erb +0 -34
- data/docs/source/shared/_header.erb +0 -61
- data/docs/source/shared/_svgs.erb +0 -17
- data/docs/source/style_guide/index.html.erb +0 -382
- data/docs/source/stylesheets/_base.scss +0 -125
- data/docs/source/stylesheets/_components.scss +0 -669
- data/docs/source/stylesheets/_helpers.scss +0 -10
- data/docs/source/stylesheets/_opinions.scss +0 -42
- data/docs/source/stylesheets/_settings.scss +0 -56
- data/docs/source/stylesheets/_typography.scss +0 -119
- data/docs/source/stylesheets/site.css.scss +0 -14
- data/docs/source/stylesheets/vendor/_avalanche.scss +0 -328
- data/docs/source/stylesheets/vendor/_normalize.scss +0 -341
- data/docs/source/stylesheets/vendor/highlight/_tomorrow_night_blue.scss +0 -75
- data/docs/source/upgrade-guides/workarea-3-4-0.html.md +0 -152
- data/docs/source/upgrade-guides.html.md +0 -18
- data/docs/workarea_renderer.rb +0 -8
- data/docs/yarn.lock +0 -2522
@@ -1,914 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Testing
|
3
|
-
excerpt: Workarea applications include an automated test suite. Tests are written using Minitest and follow the conventions for testing Rails applications, with some extensions. I don't cover Minitest and Rails testing in this guide since those topics are cove
|
4
|
-
---
|
5
|
-
|
6
|
-
# Testing
|
7
|
-
|
8
|
-
Workarea applications include an automated test suite. Tests are written using [Minitest](http://www.rubydoc.info/gems/minitest/5.9.1 "Minitest 5.9.1 API documentation") and follow the conventions for [testing Rails applications](http://guides.rubyonrails.org/v5.0/testing.html "A Guide to Testing Rails Applications (v5.0)"), with some extensions. I don't cover Minitest and Rails testing in this guide since those topics are covered extensively elsewhere. Instead, I focus on Workarea APIs, extensions, and conventions used to test Workarea applications and plugins.
|
9
|
-
|
10
|
-
As of version 3.2, the Workarea platform test suite is composed of tests written for Minitest and [Teaspoon](https://github.com/jejacks0n/teaspoon). In this guide I will focus on Minitest tests, because you can run and extend those tests from within your application (or plugin). <sup><a href="#notes" id="note-1-context">[1]</a></sup>
|
11
|
-
|
12
|
-
As you develop your application—by installing plugins, extending the platform's functionality, and adding functionality of your own—you will inevitably break existing functionality and introduce new functionality that may be broken or become broken over time. You should therefore run and maintain the platform test suite as you develop.
|
13
|
-
|
14
|
-
## Running Tests
|
15
|
-
|
16
|
-
Workarea applications include multiple test runners: the standard Rails test runner for running tests unique to the application, and several Workarea test runners to run the Workarea test suite (including your application's extensions to that suite). For the greatest test coverage, you need to use the Rails test runner **and** a Workarea test runner.
|
17
|
-
|
18
|
-
### Listing Test Runners
|
19
|
-
|
20
|
-
Test runners are rake tasks. The following example lists the test runners available to a sample Workarea application.
|
21
|
-
|
22
|
-
```bash
|
23
|
-
$ bin/rails -T test
|
24
|
-
rails test # Runs all tests in test folder except system ones
|
25
|
-
rails test:db # Run tests quickly, but also reset db
|
26
|
-
rails test:system # Run system tests only
|
27
|
-
rails workarea:test # Run workarea tests (with decorators)
|
28
|
-
rails workarea:test:app # Run all app-specific tests
|
29
|
-
rails workarea:test:admin # Run workarea admin tests (with decorators)
|
30
|
-
rails workarea:test:blog # Run workarea blog tests (with decorators)
|
31
|
-
rails workarea:test:browseoption # Run workarea browseoption tests (with decorators)
|
32
|
-
rails workarea:test:clothing # Run workarea clothing tests (with decorators)
|
33
|
-
rails workarea:test:contentsearch # Run workarea contentsearch tests (with decorators)
|
34
|
-
rails workarea:test:core # Run workarea/core tests (with decorators)
|
35
|
-
rails workarea:test:decorated # Run decorated tests
|
36
|
-
rails workarea:test:packageproducts # Run workarea packageproducts tests (with decorators)
|
37
|
-
rails workarea:test:reviews # Run workarea reviews tests (with decorators)
|
38
|
-
rails workarea:test:share # Run workarea share tests (with decorators)
|
39
|
-
rails workarea:test:storefront # Run workarea storefront tests (with decorators)
|
40
|
-
```
|
41
|
-
|
42
|
-
### Rails Test Runner
|
43
|
-
|
44
|
-
Test files in your application are a combination of tests and decorators. The tests are testing functionality unique to your application, while the decorators are testing your extensions to the Workarea platform.
|
45
|
-
|
46
|
-
Use the Rails test runner to run the tests unique to your **application**. You can also use the Rails test runner to run the platform's tests, but you need to provide the paths to those test files as arguments. It is therefore more convenient to use the Workarea test runners for that purpose.
|
47
|
-
|
48
|
-
```bash
|
49
|
-
$ bin/rails test --help
|
50
|
-
minitest options:
|
51
|
-
-h, --help Display this help.
|
52
|
-
-s, --seed SEED Sets random seed. Also via env. Eg: SEED=n rake
|
53
|
-
-v, --verbose Verbose. Show progress processing files.
|
54
|
-
-n, --name PATTERN Filter run on /regexp/ or string.
|
55
|
-
--exclude PATTERN Exclude /regexp/ or string from run.
|
56
|
-
|
57
|
-
Known extensions: rails, minitest_reporter, workarea, pride
|
58
|
-
|
59
|
-
Usage: bin/rails test [options] [files or directories]
|
60
|
-
You can run a single test by appending a line number to a filename:
|
61
|
-
|
62
|
-
bin/rails test test/models/user_test.rb:27
|
63
|
-
|
64
|
-
You can run multiple files and directories at the same time:
|
65
|
-
|
66
|
-
bin/rails test test/controllers test/integration/login_test.rb
|
67
|
-
|
68
|
-
By default test failures and errors are reported inline during a run.
|
69
|
-
|
70
|
-
Rails options:
|
71
|
-
-e, --environment ENV Run tests in the ENV environment
|
72
|
-
-b, --backtrace Show the complete backtrace
|
73
|
-
-d, --defer-output Output test failures and errors after the test run
|
74
|
-
-f, --fail-fast Abort test run on first failure or error
|
75
|
-
-c, --[no-]color Enable color in the output
|
76
|
-
```
|
77
|
-
|
78
|
-
If you do not specify the optional _[files or directories]_ argument (see _usage_, above), the test runner uses a default pattern to choose which test files to run. This pattern excludes pathnames matching _test/system/\*\*/\*_. To include system tests, you must explicitly specifiy a pattern. The following example runs all tests within the application's _test_ directory (note the quotes which are required to pass the pattern itself as an argument).
|
79
|
-
|
80
|
-
```bash
|
81
|
-
$ bin/rails test 'test/**/*_test.rb'
|
82
|
-
```
|
83
|
-
|
84
|
-
|
85
|
-
#### Running Decorated Tests in Isolation
|
86
|
-
|
87
|
-
To run a test that you've decorated (e.g., a `.decorator` file in the `test/` directory), you must run the original `.rb` file that the test originated from. Your decorations will apply at runtime, much like how decoration works in the application code.
|
88
|
-
|
89
|
-
For example, given this decorator in **test/models/workarea/user_test.decorator**:
|
90
|
-
|
91
|
-
```ruby
|
92
|
-
module Workarea
|
93
|
-
decorate UserTest do
|
94
|
-
def test_new_example
|
95
|
-
assert create_user.persisted?
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
```
|
100
|
-
|
101
|
-
Run the following command to run all `UserTest` examples in isolation:
|
102
|
-
|
103
|
-
```bash
|
104
|
-
$ bin/rails test $(bundle show workarea-core)/test/models/workarea/user_test.rb
|
105
|
-
```
|
106
|
-
|
107
|
-
You can also opt to run a single test in isolation, using the `-n` parameter:
|
108
|
-
|
109
|
-
```bash
|
110
|
-
$ bin/rails test $(bundle show workarea-core)/test/models/workarea/user_test.rb -n test_new_example
|
111
|
-
```
|
112
|
-
|
113
|
-
### Workarea Test Runners
|
114
|
-
|
115
|
-
Use the Workarea test runners to run **Workarea platform tests, including your application's extensions to those tests** (your test decorators). Choose the test runner that represents the tests you want to run: all tests, the tests from a particular engine, or only the tests your application is decorating (_workarea:test:decorated_).
|
116
|
-
|
117
|
-
The Workarea test runners will honor the same options and arguments as the Rails test runner, but you must pass them by setting the `TESTOPTS` shell variable rather than including them as options and arguments in the command line. The example below runs all platform tests with the _verbose_ and _seed_ options.
|
118
|
-
|
119
|
-
```bash
|
120
|
-
$ TESTOPTS='-v -s 51477' bin/rails workarea:test:decorated
|
121
|
-
```
|
122
|
-
|
123
|
-
|
124
|
-
### Re-Running Failures
|
125
|
-
|
126
|
-
When a test fails, the test runner provides an example command line you can use to re-run only the failed test. You should be aware of the following details regarding the example command line.
|
127
|
-
|
128
|
-
First, the example command line **always uses the Rails test runner** , even if the Workarea test runner was used to produce the failure. This is not a problem, but beware of which test runner you are using since you have to pass options and arguments differently depending on the runner.
|
129
|
-
|
130
|
-
Second, if the failing test is defined in a decorator, the example command line to re-run the test provides the path to the **original test case file** instead of the path to the decorator file. **Do not pass decorator paths as test runner arguments** —Minitest cannot load decorator files.
|
131
|
-
|
132
|
-
The following example shows a test failure from a decorator. Notice how the command line to re-run the test provides the path to the original test case file.
|
133
|
-
|
134
|
-
```bash
|
135
|
-
$ bin/rails workarea:test:decorated
|
136
|
-
Run options: --seed 34356
|
137
|
-
|
138
|
-
# Running:
|
139
|
-
|
140
|
-
..F
|
141
|
-
|
142
|
-
Failure:
|
143
|
-
Workarea::ApplicationDocumentTest#test_cleaning_array_values [/.../test/models/workarea/application_document_test.decorator:6]:
|
144
|
-
Expected false to be truthy.
|
145
|
-
|
146
|
-
From decorator: test/workers/workarea/mark_discounts_as_redeemed_test.decorator:5
|
147
|
-
bin/rails test /.../ruby/2.4.0/gems/workarea-core-3.0.10/test/models/workarea/application_document_test.rb
|
148
|
-
|
149
|
-
Finished in 0.157878s, 31.6699 runs/s, 31.6699 assertions/s.
|
150
|
-
|
151
|
-
4 runs, 4 assertions, 1 failures, 0 errors, 0 skips
|
152
|
-
```
|
153
|
-
|
154
|
-
|
155
|
-
## Writing Tests
|
156
|
-
|
157
|
-
You can extend platform tests by decorating test case classes the same way you decorate other platform classes. To test functionality that isn't already covered by the platform's test suite, write new tests within your application.
|
158
|
-
|
159
|
-
### Writing Test Decorators
|
160
|
-
|
161
|
-
To [decorate](decoration.html) a test case, create a _.decorator_ file within your application with the same base name and path as the test case file in Workarea. Require the application test helper at the top of your decorator, and use the `decorate` method to decorate the test case class.
|
162
|
-
|
163
|
-
The following annotated examples show the `BulkIndexProductsTest` test case from Core, and a decorator for that test case from the [Workarea Browse Option](https://github.com/workarea-commerce/workarea-browse-option) plugin. Decorating tests works the same way in plugins as it does in applications. <sup><a href="#notes" id="note-2-context">[2]</a></sup>
|
164
|
-
|
165
|
-
**Notice the uniformity of the filesystem paths and the Ruby namespaces (the module nesting) between both files. For a test decorator to run properly, the filesystem paths and Ruby namespaces of both files must be aligned.**
|
166
|
-
|
167
|
-
```ruby
|
168
|
-
# original test case from workarea-core
|
169
|
-
# workarea-core/test/workers/workarea/bulk_index_products_test.rb
|
170
|
-
|
171
|
-
require 'test_helper'
|
172
|
-
|
173
|
-
module Workarea
|
174
|
-
class BulkIndexProductsTest < Workarea::TestCase
|
175
|
-
|
176
|
-
def test_perform
|
177
|
-
Workarea::Search::Storefront.reset_indexes!
|
178
|
-
|
179
|
-
Sidekiq::Callbacks.disable(IndexProduct) do
|
180
|
-
products = Array.new(2) { create_product }
|
181
|
-
|
182
|
-
assert_equal(0, Search::Storefront.count)
|
183
|
-
BulkIndexProducts.new.perform(products.map(&:id))
|
184
|
-
assert_equal(2, Search::Storefront.count)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
```
|
190
|
-
|
191
|
-
```ruby
|
192
|
-
# decorator from the workarea-browse_option plugin
|
193
|
-
# workarea-browse_option/test/workers/workarea/bulk_index_products_test.decorator
|
194
|
-
|
195
|
-
require 'test_helper'
|
196
|
-
|
197
|
-
module Workarea
|
198
|
-
decorate BulkIndexProductsTest, with: :browse_option do
|
199
|
-
|
200
|
-
# Replaces the only existing test within the test case
|
201
|
-
def test_perform
|
202
|
-
Workarea::Search::Storefront.reset_indexes!
|
203
|
-
|
204
|
-
Sidekiq::Callbacks.disable(IndexProduct) do
|
205
|
-
products = Array.new(2) { create_product }
|
206
|
-
|
207
|
-
assert_equal(0, Search::Storefront.count)
|
208
|
-
BulkIndexProducts.new.perform(products.map(&:id))
|
209
|
-
assert_equal(2, Search::Storefront.count)
|
210
|
-
|
211
|
-
products.first.update_attributes!(
|
212
|
-
browse_option: 'color',
|
213
|
-
variants: [
|
214
|
-
{ sku: 'SKU1', details: { color: ['Red'] } },
|
215
|
-
{ sku: 'SKU2', details: { color: ['Blue'] } }
|
216
|
-
]
|
217
|
-
)
|
218
|
-
|
219
|
-
assert_equal(2, Search::Storefront.count)
|
220
|
-
BulkIndexProducts.new.perform(products.map(&:id))
|
221
|
-
assert_equal(3, Search::Storefront.count)
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
# Adds an additional test to the test case
|
226
|
-
def test_escaping_product_ids
|
227
|
-
Workarea::Search::Storefront.reset_indexes!
|
228
|
-
|
229
|
-
foo_bar = create_product(id: 'FOO BAR')
|
230
|
-
IndexProduct.perform(create_product(id: 'FOO'))
|
231
|
-
IndexProduct.perform(create_product(id: 'BAR'))
|
232
|
-
IndexProduct.perform(foo_bar)
|
233
|
-
|
234
|
-
IndexProduct.clear(foo_bar)
|
235
|
-
assert_equal(Search::Storefront.count, 2)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
```
|
240
|
-
|
241
|
-
Within a test case decorator, you can extend every method in the test case and its ancestor chain, including setup/teardown methods, shared behaviors, factories, and other test helpers.
|
242
|
-
|
243
|
-
When you're ready to run a test you've decorated, you must provide the path to the original test case file, not your decorator file. See re-running failures above.
|
244
|
-
|
245
|
-
### Skipping Tests & Resolving Conflicts
|
246
|
-
|
247
|
-
As an application developer, you have final say over your test suite. Base platform and plugin test suites are written in isolation from each other, so when these tests are combined in a production application, some undesirable behavior may result. Plugins may provide overlapping or even conflicting functionality, which may cause tests that would otherwise pass to fail when run from your application. When this occurs, you will need to decorate the problematic tests to fix them.
|
248
|
-
|
249
|
-
Where appropriate, use the Minitest methods `skip` and `pass` to skip over or automatically pass particular tests. Feel empowered to do this for all tests that create problems for your application, whether temporarily or permanently. The following examples demonstrate some uses for skipping tests in a sample application.
|
250
|
-
|
251
|
-
```ruby
|
252
|
-
# board-game-supercenter/test/system/workarea/storefront/users/hearts_system_test.decorator
|
253
|
-
|
254
|
-
require 'test_helper'
|
255
|
-
|
256
|
-
module Workarea
|
257
|
-
decorate Storefront::Users::HeartsSystemTest do
|
258
|
-
# skip all tests in this test case
|
259
|
-
decorated { setup :skip }
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
# board-game-supercenter/test/system/workarea/admin/inventory_skus_system_test.decorator
|
264
|
-
|
265
|
-
require 'test_helper'
|
266
|
-
|
267
|
-
module Workarea
|
268
|
-
decorate Admin::InventorySkusSystemTest do
|
269
|
-
def test_editing_a_non_existent_sku
|
270
|
-
skip('removed this feature')
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
# board-game-supercenter/test/system/workarea/admin/publish_authorization_system_test.decorator
|
276
|
-
|
277
|
-
require 'test_helper'
|
278
|
-
|
279
|
-
module Workarea
|
280
|
-
decorate Admin::PublishAuthorizationSystemTest do
|
281
|
-
def test_user_cannot_select_publish_now_in_workflows
|
282
|
-
skip('defer until custom permission is implemented')
|
283
|
-
end
|
284
|
-
|
285
|
-
def test_user_cannot_submit_form_without_selecting_a_release
|
286
|
-
skip('defer until custom permission is implemented')
|
287
|
-
end
|
288
|
-
end
|
289
|
-
end
|
290
|
-
|
291
|
-
# board-game-supercenter/test/documentation/workarea/api/storefront/checkouts_documentation_test.decorator
|
292
|
-
|
293
|
-
require 'test_helper'
|
294
|
-
|
295
|
-
module Workarea
|
296
|
-
decorate Api::Storefront::CheckoutsDocumentationTest do
|
297
|
-
def test_and_document_complete
|
298
|
-
skip('remove until gift card upgrade')
|
299
|
-
end
|
300
|
-
def test_and_document_update
|
301
|
-
skip('remove until gift card upgrade')
|
302
|
-
end
|
303
|
-
def test_and_document_reset
|
304
|
-
skip('remove until gift card upgrade')
|
305
|
-
end
|
306
|
-
def test_and_document_show
|
307
|
-
skip('remove until gift card upgrade')
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
# board-game-supercenter/test/models/workarea/payment/refund/credit_card_test.decorator
|
313
|
-
|
314
|
-
require 'test_helper'
|
315
|
-
|
316
|
-
module Workarea
|
317
|
-
decorate Payment::Refund::CreditCardTest do
|
318
|
-
def test_complete_refunds_on_the_credit_card_gateway
|
319
|
-
skip('skip until gateway bug is resolved')
|
320
|
-
end
|
321
|
-
end
|
322
|
-
end
|
323
|
-
```
|
324
|
-
|
325
|
-
### Writing New Tests
|
326
|
-
|
327
|
-
Write new test cases to cover functionality not covered by platform tests, such as new features unique to your application.
|
328
|
-
|
329
|
-
When writing new tests, follow Workarea conventions (such as file names/paths and method names). The following examples show the boilerplate for a new [worker](workers.html) and its associated test case.
|
330
|
-
|
331
|
-
```ruby
|
332
|
-
# app/workers/workarea/import_inventory.rb
|
333
|
-
|
334
|
-
module Workarea
|
335
|
-
class ImportInventory
|
336
|
-
include Sidekiq::Worker
|
337
|
-
|
338
|
-
def perform(*)
|
339
|
-
# ...
|
340
|
-
end
|
341
|
-
end
|
342
|
-
end
|
343
|
-
```
|
344
|
-
|
345
|
-
```ruby
|
346
|
-
# test/workers/workarea/import_inventory_test.rb
|
347
|
-
|
348
|
-
require 'test_helper'
|
349
|
-
|
350
|
-
module Workarea
|
351
|
-
class ImportInventoryTest < TestCase
|
352
|
-
|
353
|
-
def test_perform
|
354
|
-
# ...
|
355
|
-
end
|
356
|
-
end
|
357
|
-
end
|
358
|
-
```
|
359
|
-
|
360
|
-
In the example above, I require the application test helper, which bootstraps the test run with test setup and configuration from Rails and Workarea. Then I define a new test case class which inherits from `Workarea::TestCase`. Workarea provides a variety of test case classes from which your test cases can inherit. These are covered below.
|
361
|
-
|
362
|
-
When you're ready to run your tests, use the Rails test runner.
|
363
|
-
|
364
|
-
### Testing Configuration and Locales
|
365
|
-
|
366
|
-
Workarea and its plugins include a plethora of configuration options that define the behavior of its components. To sufficiently test this behavior, helpers are made available in your tests to help simulate different configuration scenarios for your application.
|
367
|
-
|
368
|
-
#### Temporarily Changing Global Configuration
|
369
|
-
|
370
|
-
To ensure that global configuration changes affect your code in expected ways, you can apply different configuration settings temporarily and run tests as if they are part of the global configuration. For example, here's a unit test from core that uses `Workarea.with_config` to ensure that admins are not affected by a change in `config.password_strength`:
|
371
|
-
|
372
|
-
```ruby
|
373
|
-
module Workarea
|
374
|
-
class UserTest < TestCase
|
375
|
-
def test_admins_have_more_advanced_password_requirements
|
376
|
-
Workarea.with_config do |config|
|
377
|
-
config.password_strength = :weak
|
378
|
-
|
379
|
-
user = User.new(admin: false, password: 'password').tap(&:valid?)
|
380
|
-
assert(user.errors[:password].blank?)
|
381
|
-
|
382
|
-
user = User.new(admin: true, password: 'password').tap(&:valid?)
|
383
|
-
assert(user.errors[:password].present?)
|
384
|
-
|
385
|
-
user = User.new(admin: true, password: 'xykrDQXT]9Ai7XEXfe').tap(&:valid?)
|
386
|
-
assert(user.errors[:password].blank?)
|
387
|
-
end
|
388
|
-
end
|
389
|
-
end
|
390
|
-
end
|
391
|
-
```
|
392
|
-
|
393
|
-
#### Temporarily Changing Locale
|
394
|
-
|
395
|
-
It's also possible to change the locale for the duration of a test, using the `I18n.with_locale` method. This is the method used to change locale in `Workarea::I18nServerMiddleware`, but it's also useful within tests like so:
|
396
|
-
|
397
|
-
```ruby
|
398
|
-
module Workarea
|
399
|
-
decorate UserTest do
|
400
|
-
def test_title
|
401
|
-
user = create_user
|
402
|
-
|
403
|
-
I18n.with_locale :en do
|
404
|
-
assert_equal 'Mister', user.title
|
405
|
-
end
|
406
|
-
|
407
|
-
I18n.with_locale :es do
|
408
|
-
assert_equal 'Señor', user.title
|
409
|
-
end
|
410
|
-
end
|
411
|
-
end
|
412
|
-
end
|
413
|
-
```
|
414
|
-
|
415
|
-
#### Time Manipulation
|
416
|
-
|
417
|
-
In previous versions of Workarea, the [Timecop](https://github.com/travisjeffery/timecop) gem was used to simulate running code at different points in time. Since Workarea 3.0.0, [ActiveSupport's Time Helpers](https://api.rubyonrails.org/v5.2/classes/ActiveSupport/Testing/TimeHelpers.html) methods (like `travel_to`) are used for changing the current time and date. Note that changes to the current time will *not* carry over to other tests, `Time.current` is reset to the actual current time of the machine after executing each test. Here's an example using `travel_to` within a unit test to see how data is presented over time:
|
418
|
-
|
419
|
-
```ruby
|
420
|
-
module Workarea
|
421
|
-
module Analytics
|
422
|
-
class DailyDataTest < TestCase
|
423
|
-
def test_days_ago_index
|
424
|
-
travel_to '2017/2/19'.in_time_zone(Workarea.config.analytics_timezone)
|
425
|
-
assert_equal(6, DailyData.days_ago_index(1))
|
426
|
-
assert_equal(5, DailyData.days_ago_index(2))
|
427
|
-
|
428
|
-
travel_to '2017/2/20'.in_time_zone(Workarea.config.analytics_timezone)
|
429
|
-
assert_equal(0, DailyData.days_ago_index(1))
|
430
|
-
assert_equal(6, DailyData.days_ago_index(2))
|
431
|
-
end
|
432
|
-
end
|
433
|
-
end
|
434
|
-
end
|
435
|
-
```
|
436
|
-
|
437
|
-
|
438
|
-
### Conditionally Defining Tests
|
439
|
-
|
440
|
-
As a plugin author, you can't control the environment in which your plugins' tests are run. It is therefore useful to define some tests only when certain conditions are met, such as another particular plugin being installed or optional code being present in the environment. The following examples demonstrate the concept of conditionally defining tests.
|
441
|
-
|
442
|
-
The following examples from Browse Option, Clothing, and Gift Cards demonstrate conditionally defining tests when another plugin is installed.
|
443
|
-
|
444
|
-
```ruby
|
445
|
-
# workarea-browse_option-1.2.1/test/integration/workarea/api/storefront/browse_option_product_integration_test.rb
|
446
|
-
|
447
|
-
require 'test_helper'
|
448
|
-
|
449
|
-
module Workarea
|
450
|
-
module Api
|
451
|
-
module Storefront
|
452
|
-
class BrowseOptionProductIntegrationTest < Workarea::IntegrationTest
|
453
|
-
if Plugin.installed?('Workarea::Api::Storefront')
|
454
|
-
setup :product, :category, :index_product
|
455
|
-
|
456
|
-
def product
|
457
|
-
# ...
|
458
|
-
end
|
459
|
-
|
460
|
-
def category
|
461
|
-
# ...
|
462
|
-
end
|
463
|
-
|
464
|
-
def index_product
|
465
|
-
# ...
|
466
|
-
end
|
467
|
-
|
468
|
-
def test_category_show
|
469
|
-
# ...
|
470
|
-
end
|
471
|
-
|
472
|
-
def test_product_show
|
473
|
-
# ...
|
474
|
-
end
|
475
|
-
end
|
476
|
-
end
|
477
|
-
end
|
478
|
-
end
|
479
|
-
end
|
480
|
-
```
|
481
|
-
|
482
|
-
```ruby
|
483
|
-
# workarea-clothing-2.1.1/test/integration/workarea/api/storefront/product_swatches_integration_test.rb
|
484
|
-
|
485
|
-
require 'test_helper'
|
486
|
-
|
487
|
-
module Workarea
|
488
|
-
module Api
|
489
|
-
module Storefront
|
490
|
-
class ProductSwatchesIntegrationTest < Workarea::IntegrationTest
|
491
|
-
if Plugin.installed?('Workarea::Api::Storefront')
|
492
|
-
setup :set_product
|
493
|
-
|
494
|
-
def set_product
|
495
|
-
# ...
|
496
|
-
end
|
497
|
-
|
498
|
-
def test_shows_products
|
499
|
-
# ...
|
500
|
-
end
|
501
|
-
end
|
502
|
-
end
|
503
|
-
end
|
504
|
-
end
|
505
|
-
end
|
506
|
-
```
|
507
|
-
|
508
|
-
```ruby
|
509
|
-
# workarea-gift_cards-3.2.0/test/integration/workarea/api/storefront/balance_integration_test.rb
|
510
|
-
|
511
|
-
require 'test_helper'
|
512
|
-
|
513
|
-
module Workarea
|
514
|
-
if Plugin.installed?(:api)
|
515
|
-
module Api
|
516
|
-
module Storefront
|
517
|
-
class BalanceIntegrationTest < Workarea::IntegrationTest
|
518
|
-
def test_balance_lookup
|
519
|
-
# ...
|
520
|
-
end
|
521
|
-
end
|
522
|
-
end
|
523
|
-
end
|
524
|
-
end
|
525
|
-
end
|
526
|
-
```
|
527
|
-
|
528
|
-
The following examples from Address Verification wrap test definitions in two other types of conditionals. The first, `Workarea::TestCase.running_in_gem?` is true only when the test case is run from the engine's embedded "dummy" app. This allows defining tests that are useful to the plugin maintainers but may be problematic to include in the test suites of applications that install the plugin.
|
529
|
-
|
530
|
-
The other, `Workarea.const_defined?` tests the environment for the presence of a particular constant before defining tests. Address Verification supports multiple address verification gateways (and therefore provides tests for multiple gateways), but only one gateway will be installed in a production app. The conditional ensures tests for only the installed gateway are run.
|
531
|
-
|
532
|
-
```ruby
|
533
|
-
# workarea-address_verification-2.0.2/test/lib/workarea/address_verification/ups_gateway_test.rb
|
534
|
-
|
535
|
-
require 'test_helper'
|
536
|
-
|
537
|
-
if Workarea::TestCase.running_in_gem? ||
|
538
|
-
Workarea.const_defined?('AddressVerification::UpsGateway')
|
539
|
-
|
540
|
-
require 'workarea/address_verification/ups_gateway'
|
541
|
-
|
542
|
-
module Workarea
|
543
|
-
module AddressVerification
|
544
|
-
class UpsGatewayTest < TestCase
|
545
|
-
def test_verify
|
546
|
-
# ...
|
547
|
-
end
|
548
|
-
end
|
549
|
-
end
|
550
|
-
end
|
551
|
-
end
|
552
|
-
|
553
|
-
# workarea-address_verification-2.0.2/test/lib/workarea/address_verification/melissa_data_gateway_test.rb
|
554
|
-
|
555
|
-
require 'test_helper'
|
556
|
-
|
557
|
-
if Workarea::TestCase.running_in_gem? ||
|
558
|
-
Workarea.const_defined?('AddressVerification::MelissaDataGateway')
|
559
|
-
|
560
|
-
require 'workarea/address_verification/melissa_data_gateway'
|
561
|
-
|
562
|
-
module Workarea
|
563
|
-
module AddressVerification
|
564
|
-
class MelissaDataGatewayTest < TestCase
|
565
|
-
def test_verify
|
566
|
-
# ...
|
567
|
-
end
|
568
|
-
end
|
569
|
-
end
|
570
|
-
end
|
571
|
-
end
|
572
|
-
```
|
573
|
-
|
574
|
-
## Test Case Types
|
575
|
-
|
576
|
-
All Workarea test cases inherit from one of the test case types below. The test case types generally differ in the size and scope of the Ruby API available within the test case, and the amount and type of setup and teardown that's done before/after each test in the test case.
|
577
|
-
|
578
|
-
For example, `Workarea::SystemTest` provides a staggering 584 instance methods and starts up a headless browser to interact with the running application before each test. This provides greater test fidelity and flexibility than other test types, but slower performance. Meanwhile, `Workarea::GeneratorTest` provides a smaller Ruby API specialized for testing generators (scripts) and does not perform any setup.
|
579
|
-
|
580
|
-
I summarize each of the test case types below. **All** of the test types below extend `Workarea::TestCase::Decoration`, which allows applications and plugins to decorate the tests within that test case (and test cases that inherit from it).
|
581
|
-
|
582
|
-
### Generic Tests
|
583
|
-
|
584
|
-
Generic test cases inherit from `Workarea::TestCase`.
|
585
|
-
|
586
|
-
Among the ancestors of `Workarea::TestCase` are `ActiveSupport::TestCase`, `Minitest::Test`, `Minitest::Assertions`, `ActiveSupport::Testing::Assertions`, and `ActiveSupport::Testing::TimeHelpers`. The class's instance methods include `running_in_gem?`, which is also available as the class method `Workarea::TestCase.running_in_gem?`.
|
587
|
-
|
588
|
-
### Integration Tests
|
589
|
-
|
590
|
-
Test cases inheriting from `Workarea::IntegrationTest` are testing how various parts of the platform and/or application are interacting.
|
591
|
-
|
592
|
-
`Workarea::IntegrationTest` inherits directly from `ActionDispatch::IntegrationTest`. Beginning with Workarea 3.1.0, `Workarea::IntegrationTest` includes `Workarea::IntegrationTest::Configuration`, a module used to share behavior with system tests. The class's instance methods include `set_current_user`.
|
593
|
-
|
594
|
-
### System Tests
|
595
|
-
|
596
|
-
Test cases inheriting from `Workarea::SystemTest` use a headless browser to interact with the application's UI the same way a user does. Workarea 3.2.0 and below used PhantomJS as a headless browser for running system tests, but Workarea 3.3.0 uses the Chrome webdriver for Selenium ("headless" Chrome) by default, which does not include a browser cache. Workarea 3.3.0 still depends on Poltergeist (the Capybara driver for PhantomJS) for upgrading applications that may still depend on facilities provided by PhantomJS, but all newly-written tests should execute under the Headless Chrome driver.
|
597
|
-
|
598
|
-
The ancestors of `Workarea::SystemTest` include `ActionDispatch::SystemTestCase` (since Workarea 3.1.0), `Workarea::IntegrationTest::Configuration` (since Workarea 3.1.0), and `Capybara::DSL`. Prior to Workarea 3.1.0, `Workarea::SystemTest` inherited directly from `Workarea::IntegrationTest`. Workarea 3.1.0 depends on Rails 5.1, which adds `ActionDispatch::SystemTestCase`, so `Workarea::SystemTest` inherits from that class instead. The instance methods for `SystemTest` include `t`, `clear_driver_cache`, and `wait_for_xhr`.
|
599
|
-
|
600
|
-
Workarea also extends the [Capybara DSL](https://github.com/teamcapybara/capybara#the-dsl) with the `#has_ordered_text?` method, available on element objects as well as generically in test case. All methods that manipulate the DOM will also call `#wait_for_xhr` before returning back to the callee, ensuring Ajax requests have finished before proceeding.
|
601
|
-
|
602
|
-
### View Tests
|
603
|
-
|
604
|
-
Test cases inheriting from `Workarea::ViewTest` provide the necessary API to test view helpers.
|
605
|
-
|
606
|
-
`Workarea::ViewTest` inherits directly from `ActionView::TestCase`. The class's instance methods include all of Rails' view helpers.
|
607
|
-
|
608
|
-
### Generator Tests
|
609
|
-
|
610
|
-
Test cases inheriting from `Workarea::GeneratorTest` provide an API suitable for testing the Rails generators included with Workarea.
|
611
|
-
|
612
|
-
`Workarea::GeneratorTest` inherits directly from `Rails::Generators::TestCase`.
|
613
|
-
|
614
|
-
## Test Help
|
615
|
-
|
616
|
-
Every test case file begins by requiring your application test helper, _test/test\_helper.rb_. This file sets up the environment for testing, as follows:
|
617
|
-
|
618
|
-
1. Boots your application in the _test_ Rails environment
|
619
|
-
2. Loads Rails' test help, _railties/lib/rails/test\_help.rb_, which bootstraps Rails testing
|
620
|
-
3. Loads Workarea's test help, _workarea-testing/lib/workarea/test\_help.rb_, which bootstraps Workarea testing
|
621
|
-
|
622
|
-
The Workarea test help file loads a large Ruby API into memory, including the Workarea test cases from which your own test cases inherit. However, it also includes many other modules that provide additional setup/teardown and instance methods to use within your tests. Many of the platform's test cases mix in these modules as needed, and they are available to mix into your own test cases as well.
|
623
|
-
|
624
|
-
### Additional Setup/Teardown
|
625
|
-
|
626
|
-
The following modules provide additional test setup and/or teardown.
|
627
|
-
|
628
|
-
- `Workarea::TestCase::Workers`
|
629
|
-
- Setup and teardown for [workers](workers.html)
|
630
|
-
- Included in `Workarea::TestCase`, `Workarea::IntegrationTest`, and `Workarea::SystemTest` by default
|
631
|
-
- `Workarea::TestCase::SearchIndexing`
|
632
|
-
- Setup for Elasticsearch indexes
|
633
|
-
- Included in `Workarea::IntegrationTest` and `Workarea::SystemTest` by default
|
634
|
-
- `Workarea::Storefront::CatalogCustomizationTestClass`
|
635
|
-
- Setup and teardown for catalog customization tests
|
636
|
-
|
637
|
-
### Tests for Shared Behavior
|
638
|
-
|
639
|
-
The following modules provide tests for shared behavior. When included in a test case, each module provides the tests indicated below.
|
640
|
-
|
641
|
-
- `Workarea::DiscountConditionTests::OrderTotal`
|
642
|
-
- `test_order_total?`
|
643
|
-
- `test_order_total_qualifies?`
|
644
|
-
|
645
|
-
- `Workarea::DiscountConditionTests::PromoCodes`
|
646
|
-
- `test_promo_codes_qualify?`
|
647
|
-
|
648
|
-
- `Workarea::DiscountConditionTests::ItemQuantity`
|
649
|
-
- `test_item_quantity?`
|
650
|
-
- `test_items_qualify?`
|
651
|
-
|
652
|
-
- `Workarea::Storefront::PaginationViewModelTest`
|
653
|
-
- `test_total_pages`
|
654
|
-
- `test_first_page`
|
655
|
-
- `test_last_page`
|
656
|
-
- `test_next_page`
|
657
|
-
- `test_prev_page`
|
658
|
-
|
659
|
-
- `Workarea::Storefront::ProductBrowsingViewModelTest`
|
660
|
-
- `test_has_filters`
|
661
|
-
- `test_facets`
|
662
|
-
|
663
|
-
### Test Helpers
|
664
|
-
|
665
|
-
The following modules provide additional instance methods that are useful in certain test situations and are usually referred to as test _helpers_ or _macros_. I've listed the helper methods for each available module below.
|
666
|
-
|
667
|
-
- `Workarea::Admin::IntegrationTest`
|
668
|
-
- `admin_user` (Also sets `current_user` to this user as additional test setup)
|
669
|
-
- `Workarea::Storefront::IntegrationTest`
|
670
|
-
- `complete_checkout`
|
671
|
-
- `product`
|
672
|
-
- `Workarea::Storefront::SystemTest`
|
673
|
-
- `add_product_to_cart`
|
674
|
-
- `add_user_data`
|
675
|
-
- `create_supporting_data`
|
676
|
-
- `fill_in_billing_address`
|
677
|
-
- `fill_in_credit_card`
|
678
|
-
- `fill_in_email`
|
679
|
-
- `fill_in_new_card_cvv`
|
680
|
-
- `fill_in_shipping_address`
|
681
|
-
- `select_shipping_service`
|
682
|
-
- `setup_checkout_specs`
|
683
|
-
- `start_guest_checkout`
|
684
|
-
- `start_user_checkout`
|
685
|
-
- `Workarea::BreakpointHelpers`
|
686
|
-
- `resize_window_to`
|
687
|
-
|
688
|
-
### Factories
|
689
|
-
|
690
|
-
_Factories_ are specialized test helpers that provide shortcuts for creating model instances. A factory method, such as `create_product`, can generally be called without arguments and creates a model instance using default data appropriate for testing.
|
691
|
-
|
692
|
-
Core factories are organized into files under _workarea-testing/lib/workarea/testing/factories/_. However, test cases that use factories mix in only `Workarea::Factories`. Including this module automatically includes all factory methods from all factory modules in Core and in all installed plugins.
|
693
|
-
|
694
|
-
The following test case types include factories by default.
|
695
|
-
|
696
|
-
- `Workarea::TestCase`
|
697
|
-
- `Workarea::IntegrationTest`
|
698
|
-
- `Workarea::SystemTest`
|
699
|
-
- `Workarea::ViewTest`
|
700
|
-
|
701
|
-
Including factories in a test case adds the following instance methods.
|
702
|
-
|
703
|
-
- `complete_checkout`
|
704
|
-
- `create_admin_bookmark`
|
705
|
-
- `create_admin_search`
|
706
|
-
- `create_admin_visit`
|
707
|
-
- `create_analytics_category_revenue`
|
708
|
-
- `create_analytics_discount_revenue`
|
709
|
-
- `create_analytics_filter`
|
710
|
-
- `create_analytics_navigation`
|
711
|
-
- `create_analytics_product`
|
712
|
-
- `create_analytics_product_revenue`
|
713
|
-
- `create_analytics_search`
|
714
|
-
- `create_asset`
|
715
|
-
- `create_bulk_action_product_edit`
|
716
|
-
- `create_buy_some_get_some_discount`
|
717
|
-
- `create_category`
|
718
|
-
- `create_category_browse_search`
|
719
|
-
- `create_category_discount`
|
720
|
-
- `create_code_list`
|
721
|
-
- `create_comment`
|
722
|
-
- `create_content`
|
723
|
-
- `create_email_signup`
|
724
|
-
- `create_export`
|
725
|
-
- `create_free_gift_discount`
|
726
|
-
- `create_help_article`
|
727
|
-
- `create_inventory`
|
728
|
-
- `create_import`
|
729
|
-
- `create_menu`
|
730
|
-
- `create_order`
|
731
|
-
- `create_order_total_discount`
|
732
|
-
- `create_page`
|
733
|
-
- `create_payment`
|
734
|
-
- `create_payment_profile`
|
735
|
-
- `create_placed_order`
|
736
|
-
- `create_pricing_sku`
|
737
|
-
- `create_product`
|
738
|
-
- `create_product_attribute_discount`
|
739
|
-
- `create_product_browse_search_options`
|
740
|
-
- `create_product_discount`
|
741
|
-
- `create_product_placeholder_image`
|
742
|
-
- `create_product_search`
|
743
|
-
- `create_quantity_fixed_price_discount`
|
744
|
-
- `create_recommendations`
|
745
|
-
- `create_redirect`
|
746
|
-
- `create_release`
|
747
|
-
- `create_saved_credit_card`
|
748
|
-
- `create_search_customization`
|
749
|
-
- `create_search_settings`
|
750
|
-
- `create_shipping`
|
751
|
-
- `create_shipping_discount`
|
752
|
-
- `create_shipping_service`
|
753
|
-
- `create_shipping_sku`
|
754
|
-
- `create_tax_category`
|
755
|
-
- `create_taxon`
|
756
|
-
- `create_user`
|
757
|
-
- `create_user_activity`
|
758
|
-
|
759
|
-
### Factory Configuration
|
760
|
-
|
761
|
-
Each factory method uses a configurable set of default values to generate a model instance when no custom values are provided. Default values are either a `Hash` or a `Proc` instance that returns a hash consisting of values that are determined at the time the method is called. A `Proc` is executed within the context of the `Workarea::Factories` module, allowing access to other factory methods to generate default values like associations or ensure a unique name is generated for each model instance generated by the factory method.
|
762
|
-
|
763
|
-
```ruby
|
764
|
-
Workarea.configure do |config|
|
765
|
-
config.testing_factory_defaults.inventory =
|
766
|
-
{ id: 'SKU', policy: 'standard', available: 5 }
|
767
|
-
|
768
|
-
config.testing_factory_defaults.audit_log_entry = Proc.new do
|
769
|
-
{ modifier: create_user, audited: create_page }
|
770
|
-
end
|
771
|
-
|
772
|
-
config.testing_factory_defaults.shipping_service = Proc.new do
|
773
|
-
{ name: "Test #{shipping_service_count}", rates: [{ price: 1.to_m }] }
|
774
|
-
end
|
775
|
-
end
|
776
|
-
```
|
777
|
-
|
778
|
-
These default values can be customized for your application to modify the default model instances across the entire test suite without having to decorate each individual test. A common use case would be adding a default value for a field that your application requires but is not required out of the base Workarea model (e.g. phone number on shipping address).
|
779
|
-
|
780
|
-
You can customize these values in your application's `test_helper.rb`
|
781
|
-
|
782
|
-
```ruby
|
783
|
-
# Modify the configuration for factory default values
|
784
|
-
# test/test_helper.rb
|
785
|
-
|
786
|
-
ENV['RAILS_ENV'] ||= 'test'
|
787
|
-
require File.expand_path('../../config/environment', __FILE__ )
|
788
|
-
require 'rails/test_help'
|
789
|
-
require 'workarea/test_help'
|
790
|
-
|
791
|
-
Workarea.configure do |config|
|
792
|
-
config.testing_factory_defaults.shipping_address[:phone_number] = '2155551212'
|
793
|
-
end
|
794
|
-
```
|
795
|
-
|
796
|
-
Additionally, you can customize the factory default values for the duration of a single test by utilizing the `Workarea.with_config` method to temporarily modify the configuration values.
|
797
|
-
|
798
|
-
```ruby
|
799
|
-
# test/system/storefront/categories_system_test.decorator
|
800
|
-
|
801
|
-
require 'test_helper'
|
802
|
-
|
803
|
-
module Workarea
|
804
|
-
decorate Storefront::CategoriesSystemTest do
|
805
|
-
|
806
|
-
# Decorate setup method
|
807
|
-
def set_products
|
808
|
-
Workarea.with_config do |config|
|
809
|
-
config.testing_factory_defaults.product.merge!(
|
810
|
-
# add customized defaults
|
811
|
-
)
|
812
|
-
|
813
|
-
super
|
814
|
-
end
|
815
|
-
end
|
816
|
-
end
|
817
|
-
end
|
818
|
-
```
|
819
|
-
|
820
|
-
## Adding & Extending Test Help
|
821
|
-
|
822
|
-
As you develop your application, you may have the need to extend the various test help modules described above, or add your own. The steps to to this are as follows.
|
823
|
-
|
824
|
-
1. Create new modules
|
825
|
-
2. Require them in your application test helper
|
826
|
-
3. Mix them into your test cases as needed
|
827
|
-
|
828
|
-
Plugins create these modules under _test/support/_ , or _test/factories/_ in the case of factories, since files at these paths are required automatically by the host application. Applications should follow these conventions, but files at these paths within the application are not required automatically, so you must require each module in your test helper.
|
829
|
-
|
830
|
-
In addition to creating your own modules, re-open existing modules as needed to extend them. The following examples show two new files: one file to add a **new factory module** , and another to **re-open an existing test helper**. Both files are **required in the application's test helper**.
|
831
|
-
|
832
|
-
```ruby
|
833
|
-
# Add factory methods to use within tests of your custom functionality
|
834
|
-
# test/factories/entertainment.rb
|
835
|
-
|
836
|
-
module Workarea
|
837
|
-
module Factories
|
838
|
-
module Entertainment
|
839
|
-
|
840
|
-
# Register your factory to include it with the other factories
|
841
|
-
Factories.add(self)
|
842
|
-
|
843
|
-
# Add as many factory methods as you need
|
844
|
-
def create_calendar(overrides = {})
|
845
|
-
attributes = { name: 'Test Calendar' }.merge(overrides)
|
846
|
-
Workarea::Entertainment::Calendar.create!(attributes)
|
847
|
-
end
|
848
|
-
|
849
|
-
# ...
|
850
|
-
end
|
851
|
-
end
|
852
|
-
end
|
853
|
-
```
|
854
|
-
|
855
|
-
```ruby
|
856
|
-
# Add a test help file which re-opens an existing test helper
|
857
|
-
# test/support/storefront_system_test_extensions.rb
|
858
|
-
|
859
|
-
# Re-open the module
|
860
|
-
module Workarea
|
861
|
-
module Storefront
|
862
|
-
module SystemTest
|
863
|
-
|
864
|
-
# Redefine or extend the module's instance methods as needed
|
865
|
-
def fill_in_email
|
866
|
-
fill_in 'email', match: :first, with: 'bcrouse-new-account@workarea.com'
|
867
|
-
end
|
868
|
-
end
|
869
|
-
end
|
870
|
-
end
|
871
|
-
```
|
872
|
-
|
873
|
-
```ruby
|
874
|
-
# Require your new modules in your test helper
|
875
|
-
# test/test_helper.rb
|
876
|
-
|
877
|
-
ENV['RAILS_ENV'] ||= 'test'
|
878
|
-
require File.expand_path('../../config/environment', __FILE__ )
|
879
|
-
require 'rails/test_help'
|
880
|
-
require 'workarea/test_help'
|
881
|
-
|
882
|
-
# Require additional test help
|
883
|
-
require 'factories/entertainment'
|
884
|
-
require 'support/storefront_system_test_extensions'
|
885
|
-
```
|
886
|
-
|
887
|
-
You can also extend the various test help methods for the duration of a single test case by decorating the test case (or defining your own test case) and extending the relevant instance methods there. The example below shows a test decorator extending a factory method.
|
888
|
-
|
889
|
-
```ruby
|
890
|
-
# test/workers/workarea/bulk_index_products_test.decorator
|
891
|
-
|
892
|
-
require 'test_helper'
|
893
|
-
|
894
|
-
module Workarea
|
895
|
-
decorate BulkIndexProductsTest do
|
896
|
-
|
897
|
-
# Decorate a factory method
|
898
|
-
def create_product
|
899
|
-
# ...
|
900
|
-
end
|
901
|
-
|
902
|
-
# Decorate a test
|
903
|
-
def test_perform
|
904
|
-
# Use the redefined create_product method within the test
|
905
|
-
end
|
906
|
-
end
|
907
|
-
end
|
908
|
-
```
|
909
|
-
|
910
|
-
## Notes
|
911
|
-
|
912
|
-
[1] If you're migrating to Workarea 3 from an earlier version, review the [<cite>Testing</cite> section of the 3.0 release notes](workarea-3-0-0.html#testing) for a summary of changes.
|
913
|
-
|
914
|
-
[2] An exception to this is the `with` option for `decorate`. By convention, plugins must include this option while applications can omit it.
|