Skip to content

Commit

Permalink
Update test to reflect proper purl URL when requesting version
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-collier committed Aug 1, 2024
1 parent 4161298 commit 19986bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spec/requests/versioned_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe "Versioned File requests" do
before do
allow(Cocina).to receive(:find).and_return(Cocina.new(public_json))
allow(Cocina).to receive(:find).and_call_original
end

let(:druid) { 'nr349ct7889' }
Expand Down Expand Up @@ -71,6 +71,8 @@
before do
allow_any_instance_of(FileController).to receive(:send_file)
.with('spec/fixtures/nr/349/ct/7889/path/to/image.jp2', disposition: :inline)
stub_request(:get, "https://purl.stanford.edu/#{druid}/#{version_id}.json")
.to_return(status: 200, body: public_json.to_json)
end

it 'returns a successful HTTP response' do
Expand All @@ -81,6 +83,11 @@
end

describe 'GET missing file' do
before do
stub_request(:get, "https://purl.stanford.edu/xf680rd3068/v1.json")
.to_return(status: 200, body: public_json.to_json)
end

it 'returns a 400 HTTP response' do
get '/v2/file/xf680rd3068/v1/path/to/99999.jp2'
expect(response).to have_http_status(:not_found)
Expand Down

0 comments on commit 19986bb

Please sign in to comment.