Sha256: 76409613e3e5926bc92216b400ecea17219a1f4a8ab326d5a1c0b8eaca81553c

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class BulkActionProductEditBrowseOptionTest < Workarea::SystemTest
      include Admin::IntegrationTest

      def test_editing_browse_option
        products = Array.new(3) { create_product }
        Search::Settings.current.update_attributes!(terms_facets: %w(Color Size))

        assert_nil(products.first.browse_option)
        assert_nil(products.second.browse_option)
        assert_nil(products.third.browse_option)

        visit admin.catalog_products_path

        click_button(t('workarea.admin.catalog_products.index.edit'))

        find('#toggle_browses_by').click
        select 'Color', from: 'bulk_action[settings][browse_option]'

        click_button t('workarea.admin.bulk_action_product_edits.edit.review_changes')
        assert(page.has_content?('Browse Option Color'))
        click_button t('workarea.admin.bulk_action_product_edits.review.save_and_finish')
        assert(page.has_content?('Your product edits are being processed'))

        products.each(&:reload)

        assert_equal('Color', products.first.browse_option)
        assert_equal('Color', products.second.browse_option)
        assert_equal('Color', products.third.browse_option)

        visit admin.catalog_products_path

        click_button(t('workarea.admin.catalog_products.index.edit'))

        find('#toggle_browses_by').click
        select 'None', from: 'bulk_action[settings][browse_option]'

        click_button t('workarea.admin.bulk_action_product_edits.edit.review_changes')
        assert(page.has_content?('Browse Option'))
        click_button t('workarea.admin.bulk_action_product_edits.review.save_and_finish')
        assert(page.has_content?('Your product edits are being processed'))

        products.each(&:reload)

        refute(products.first.browse_option.present?)
        refute(products.second.browse_option.present?)
        refute(products.third.browse_option.present?)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-browse_option-2.2.0 test/system/workarea/admin/bulk_action_product_edit_browse_option_test.rb