diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb8e199..e5f776c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,11 @@ jobs: --health-timeout 5s --health-retries 5 + redis: + image: redis:latest + ports: + - 6379:6379 + env: RAILS_ENV: test DATABASE_HOST: localhost diff --git a/app/jobs/event_created_job.rb b/app/jobs/event_created_job.rb index bf7f778..1155992 100644 --- a/app/jobs/event_created_job.rb +++ b/app/jobs/event_created_job.rb @@ -1,7 +1,7 @@ class EventCreatedJob include Sidekiq::Job - sidekiq_options queue: 'reporting', retry: false, backtrace: true + sidekiq_options queue: 'events', retry: false, backtrace: true def perform(args) case args['type'] diff --git a/script/accountify/invoice/test_lifecycle.rb b/script/accountify/invoice/test_lifecycle.rb index 778bf60..0baaf43 100644 --- a/script/accountify/invoice/test_lifecycle.rb +++ b/script/accountify/invoice/test_lifecycle.rb @@ -1,6 +1,5 @@ require_relative '../../../config/environment' -# require 'time' require 'open3' user_id = 123 @@ -14,8 +13,6 @@ tenant_id: tenant_id, name: 'Debbies Debts Ltd') -sleep 1 - contact = Accountify::Contact.create( user_id: user_id, tenant_id: tenant_id, diff --git a/spec/integration/accountify/invoice/test_lifecycle_spec.rb b/spec/integration/accountify/invoice/test_lifecycle_spec.rb index b788873..c061db2 100644 --- a/spec/integration/accountify/invoice/test_lifecycle_spec.rb +++ b/spec/integration/accountify/invoice/test_lifecycle_spec.rb @@ -1,13 +1,17 @@ require 'rails_helper' RSpec.describe 'Invoice Lifecycle', type: :integration do - it 'runs the test lifecycle script' do - # TODO: work out why this fails + it 'transitions as expected' do + Sidekiq::Testing.disable! - # load Rails.root.join('script/accountify/invoice/test_lifecycle.rb') + begin + load Rails.root.join('script/accountify/invoice/test_lifecycle.rb') - # expect(Accountify::Models::Organisation.count).to eq(1) - # expect(Accountify::Models::Contact.count).to eq(1) - # expect(Accountify::Models::Invoice.count).to eq(1) + expect(Accountify::Models::Organisation.count).to eq(1) + expect(Accountify::Models::Contact.count).to eq(1) + expect(Accountify::Models::Invoice.count).to eq(1) + ensure + Sidekiq::Testing.fake! + end end end