Skip to content

Commit b647119

Browse files
committed
We had the background job to create partners in the controller happening on a successful save. This was missing out on partners created via uploading a spreadhseet
1 parent 0317f4b commit b647119

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/models/partner.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class Partner < ApplicationRecord
2626
.order(:name)
2727
}
2828

29+
after_create :register_on_partnerbase
30+
2931
# better to extract this outside of the model
3032
def self.import_csv(data, organization_id)
3133
CSV.parse(data, headers: true) do |row|
@@ -43,4 +45,8 @@ def self.csv_export_headers
4345
def csv_export_attributes
4446
[name, email]
4547
end
48+
49+
def register_on_partnerbase
50+
UpdateDiaperPartnerJob.perform_async(self.id)
51+
end
4652
end

spec/controllers/partners_controller_spec.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@
4949
expect { subject }.to change(Partner, :count).by(1)
5050
end
5151

52-
it "enqueues a UpdateDiaperPartnerJob job" do
53-
expect(UpdateDiaperPartnerJob).to receive(:perform_async)
54-
subject
55-
end
56-
5752
it "redirects to #index" do
5853
expect(subject).to redirect_to(partners_path)
5954
end

0 commit comments

Comments
 (0)