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.4.27 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.4 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.26 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.3 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.25 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.2 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.24 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.1 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.23 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.22 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.0 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.21 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.5.0.beta.1 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.20 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.19 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.18 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.17 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.16 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.15 test/integration/workarea/admin/bulk_actions_integration_test.rb
workarea-admin-3.4.14 test/integration/workarea/admin/bulk_actions_integration_test.rb