Skip to content

Commit

Permalink
Added test for Ark.update (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcorrea committed Jun 2, 2022
1 parent 6f8dc85 commit 3ded1e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/models/ark_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
end
end

describe ".update" do
let(:ark) { "ark:/88435/dsp01qb98mj541" }
let(:old_target) { "https://dataspace.princeton.edu/handle/88435/dsp01qb98mj541" }
let(:new_target) { "https://dataspace.princeton.edu/handle/88435/dsp01qb98mj541-new" }

it "makes the call to EZID" do
described_class.update(ark, new_target)
expect(@identifier).to have_received(:save!)
end

it "does not make the call to EZID" do
described_class.update(ark, old_target)
expect(@identifier).to_not have_received(:save!)
end
end

describe ".valid?" do
let(:id) { "id" }

Expand Down
3 changes: 3 additions & 0 deletions spec/support/ezid_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
allow(@identifier).to receive(:metadata).and_return(@ezid_metadata)
allow(@identifier).to receive(:id).and_return(@ezid)
allow(@identifier).to receive(:modify)
allow(@identifier).to receive(:target).and_return(@ezid_metadata_values["_target"])
allow(@identifier).to receive(:target=)
allow(@identifier).to receive(:save!)
end
end

0 comments on commit 3ded1e8

Please sign in to comment.