Sha256: e580631848cd47abff10c70025572ad12ad907db85f0c0d4d5231e05037f15b1

Contents?: true

Size: 806 Bytes

Versions: 6

Compression:

Stored size: 806 Bytes

Contents

require 'test_helper'

class DiscoApp::AppInstalledJobTest < ActionController::TestCase
  include ActiveJob::TestHelper

  def setup
    @shop = disco_app_shops(:widget_store)
  end

  def teardown
    @shop = nil
  end

  test 'app installed job performs shop update job' do
    stub_request(:post, "#{@shop.admin_url}/webhooks.json").to_return(status: 200)
    stub_request(:get, "#{@shop.admin_url}/shop.json").to_return(status: 200, body: api_fixture('widget_store/shop'))

    # Assert the main install job can be enqueued and performed.
    perform_enqueued_jobs do
      DiscoApp::AppInstalledJob.perform_later(@shop.shopify_domain)
    end
    assert_performed_jobs 1

    # Assert the update shop job was performed.
    @shop.reload
    assert_equal 'United States', @shop.country_name
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
disco_app-0.6.0 test/jobs/disco_app/app_installed_job_test.rb
disco_app-0.6.1 test/jobs/disco_app/app_installed_job_test.rb
disco_app-0.6.2 test/jobs/disco_app/app_installed_job_test.rb
disco_app-0.6.3 test/jobs/disco_app/app_installed_job_test.rb
disco_app-0.6.4 test/jobs/disco_app/app_installed_job_test.rb
disco_app-0.6.5 test/jobs/disco_app/app_installed_job_test.rb