Skip to content

Commit a9bd619

Browse files
Merge pull request #46 from Purple-Stock/feat/add-items-to-count
Feat/add items to count
2 parents d30f277 + 5e3b5d4 commit a9bd619

12 files changed

+16
-1
lines changed

app/models/bling_order_item.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class BlingOrderItem < ApplicationRecord
3838

3939
accepts_nested_attributes_for :items
4040

41+
after_create :synchronize_items
42+
4143
STORE_ID_NAME_KEY_VALUE = {
4244
'204219105' => 'Shein',
4345
'203737982' => 'Shopee',

spec/jobs/bling_order_item_creator_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1112
allow(subject).to receive(:list_status_situation).and_return([15])
1213
end

spec/jobs/canceled_bling_order_item_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1112
end
1213

spec/jobs/checked_bling_order_items_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
describe '#perform' do
1010
before do
11+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1112
allow(Date).to receive(:today).and_return Date.new(2023, 11, 15)
1213
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.zone.now + 2.days)
1314
end

spec/jobs/current_done_bling_order_item_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
allow(Date).to receive(:today).and_return Date.new(2023, 11, 9)
1112
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1213
end

spec/jobs/daily_canceled_order_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
describe '#perform' do
1313
before do
14+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1415
allow(Date).to receive(:today).and_return Date.new(2023, 12, 14)
1516
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.zone.now + 2.days)
1617
FactoryBot.create(:bling_order_item, bling_order_id:, date:, situation_id:)

spec/jobs/in_progress_order_items_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1112
end
1213

spec/jobs/pending_order_items_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1112
end
1213

spec/jobs/printed_order_items_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
BlingOrderItem.destroy_all
1112
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1213
end

spec/jobs/verified_bling_order_items_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
allow(Date).to receive(:today).and_return Date.new(2023, 11, 15)
1112
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.zone.now + 2.days)
1213
end

spec/jobs/weekly_canceled_order_items_job_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
describe '#perform_now' do
99
before do
10+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
1011
FactoryBot.create(:bling_datum, account_id: user.account.id, expires_at: Time.now + 2.day)
1112
end
1213

spec/requests/bling_order_item_histories_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
final_date: Date.today.strftime } }
1010
end
1111

12-
before { sign_in user }
12+
before do
13+
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
14+
sign_in user
15+
end
1316

1417
describe 'GET /index' do
1518
before do

0 commit comments

Comments
 (0)