Sha256: 0779181208df97a5ae6408e834fb7e85d43cba3120e2d17628b4c65df7a5d878

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

require 'test_helper'

module DiscoApp
  module Flow
    class CreateActionTest < ActiveSupport::TestCase

      include ActiveJob::TestHelper

      def setup
        @shop = disco_app_shops(:widget_store)
      end

      def teardown
        @shop = nil
      end

      test 'call to create flow action creates model' do
        result = CreateAction.call(shop: @shop, action_id: action_id, action_run_id: action_run_id, properties: properties)
        assert result.success?
        assert result.action.persisted?
        assert result.action.pending?
        assert_equal action_id, result.action.action_id
        assert_equal action_run_id, result.action.action_run_id
        assert_equal properties, result.action.properties
      end

      test 'call to create flow action enqueues processing job' do
        assert_enqueued_with(job: ProcessActionJob) do
          CreateAction.call(shop: @shop, action_id: action_id, action_run_id: action_run_id, properties: properties)
        end
      end

      private

        def action_id
          'test_action_id'
        end

        def action_run_id
          'bdb15e45-4f9d-4c80-88c8-7b43a24edaac-30892-cc8eb62a-14db-43fc-bc33-d6dea41ae623'
        end

        def properties
          {
            'customer_email' => 'name@example.com'
          }
        end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release test/services/disco_app/flow/create_action_test.rb
disco_app-0.17.0 test/services/disco_app/flow/create_action_test.rb
disco_app-0.18.0 test/services/disco_app/flow/create_action_test.rb
disco_app-0.18.2 test/services/disco_app/flow/create_action_test.rb
disco_app-0.18.3 test/services/disco_app/flow/create_action_test.rb
disco_app-0.18.6 test/services/disco_app/flow/create_action_test.rb
disco_app-0.16.1 test/services/disco_app/flow/create_action_test.rb
disco_app-0.18.4 test/services/disco_app/flow/create_action_test.rb
disco_app-0.18.1 test/services/disco_app/flow/create_action_test.rb