Skip to content

Commit

Permalink
saved_changes method behaves differently on staging server and on loc… (
Browse files Browse the repository at this point in the history
#1083)

* saved_changes method behaves differently on staging server and on local server. Hence added explicit check to check newly created record

* There are two types of DOIs are getting called in this test case, hence stubbed both DataciteDoi and Doi

* Stub the all types of DOI
  • Loading branch information
ashwinisukale authored Jan 10, 2024
1 parent d461d90 commit 876e15c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Indexable
changed_attributes = saved_changes
Rails.logger.info "[Event Data Import Message] #{aasm_state} #{changed_attributes.inspect} before call"
relevant_changes = changed_attributes.keys & %w[related_identifiers creators funding_references aasm_state]
if relevant_changes.any?
if relevant_changes.any? || (created == updated)
send_import_message(to_jsonapi)
Rails.logger.info "[Event Data Import Message] #{aasm_state} #{to_jsonapi.inspect} send to Event Data service."
end
Expand Down
1 change: 1 addition & 0 deletions spec/requests/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@
context "show" do
let(:doi) do
allow_any_instance_of(DataciteDoi).to receive(:send_import_message)
allow_any_instance_of(Doi).to receive(:send_import_message)
create(:doi, client: client, aasm_state: "findable")
end
let(:source_doi) { create(:doi, client: client, aasm_state: "findable") }
Expand Down
1 change: 1 addition & 0 deletions spec/requests/old_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@
context "show" do
let(:doi) do
allow_any_instance_of(DataciteDoi).to receive(:send_import_message)
allow_any_instance_of(Doi).to receive(:send_import_message)
create(:doi, client: client, aasm_state: "findable")
end
let(:source_doi) { create(:doi, client: client, aasm_state: "findable") }
Expand Down

0 comments on commit 876e15c

Please sign in to comment.