Sha256: 048818bcd4382b1f464a01a22ca47dbc641070516a7864aed73795ea5c89b0e2

Contents?: true

Size: 1.26 KB

Versions: 62

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class BulkActionsIntegrationTest < Workarea::IntegrationTest
      include Admin::IntegrationTest

      def test_create
        6.times.each do |id|
          create_product(id: id, name: 'foo', filters: { 'bar' => 'baz' })
        end
        post admin.bulk_actions_path,
          headers: { 'Referer' => admin.catalog_products_path },
          params: {
            type: 'Workarea::BulkAction::ProductEdit',
            query_id: Search::AdminProducts.new(q: 'foo', bar: %w(baz)).to_global_id,
            ids: %w(1 2 3),
            exclude_ids: %w(4 5 6)
          }

        assert_equal(1, BulkAction.count)
        assert_equal(1, BulkAction::ProductEdit.count)

        result = BulkAction::ProductEdit.first
        assert_equal(%w(1 2 3), result.ids)
        assert_equal(%w(4 5 6), result.exclude_ids)

        assert_redirected_to(admin.edit_bulk_action_product_edit_path(result))
      end

      def test_destroy
        query = Search::AdminProducts.new
        action = BulkAction.create!(query_id: query.to_global_id)

        delete admin.bulk_action_path(action)

        assert_equal(0, BulkAction.count)
        assert_raises(Mongoid::Errors::DocumentNotFound) { action.reload }
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.26 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.45 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.25 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.23 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.44 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.22 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.43 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.21 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.42 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.20 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.41 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.19 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.40 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.18 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.39 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.17 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.38 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.16 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.37 test/integration/workarea/admin/bulk_actions_integration_test.rb