Skip to content

Commit

Permalink
Update stub_request to read apikey from config
Browse files Browse the repository at this point in the history
  • Loading branch information
christinach committed Aug 14, 2023
1 parent 66fa270 commit cc8aef2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spec/models/alma_bib_norm/alma_bib_norm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
describe "submit job to Alma API" do
context "with a successful response" do
before do
stub_request(:post, "https://alma/almaws/v1/conf/jobs/M7407373650006421?apikey&op=run")
stub_request(:post, "https://alma/almaws/v1/conf/jobs/M7407373650006421?apikey=#{LibJobs.config[:alma_api_key]}&op=run")
.to_return(status: 200, body: success, headers:)
end

Expand All @@ -51,13 +51,12 @@

context "with an unsuccessful response" do
before do
stub_request(:post, "https://alma/almaws/v1/conf/jobs/M7407373650006421?apikey&op=run")
stub_request(:post, "https://alma/almaws/v1/conf/jobs/M7407373650006421?apikey=#{LibJobs.config[:alma_api_key]}&op=run")
.to_return(status: 400, body: error, headers:)
end

it "returns a response wtih 400 and error messsage" do
expect(alma_bib_norm.run).to be_falsey

data_set = DataSet.last
expect(data_set.category).to eq("PulBibNorm")
expect(data_set.status).to eq(false)
Expand Down

0 comments on commit cc8aef2

Please sign in to comment.