Ensure HEAD on API sounds/show behave correctly
This commit is contained in:
parent
464a16e964
commit
50c57e8bbd
@ -2,9 +2,10 @@ describe 'API sounds' do
|
|||||||
before { api_sign_in }
|
before { api_sign_in }
|
||||||
|
|
||||||
describe 'sound show' do
|
describe 'sound show' do
|
||||||
let(:sound) { create :sound }
|
let(:sound) { create :sound }
|
||||||
let(:request_show) { get api_sound_path sound }
|
let(:request_method) { :get }
|
||||||
subject { response }
|
let(:request_show) { send request_method, api_sound_path(sound) }
|
||||||
|
subject { response }
|
||||||
|
|
||||||
before { request_show }
|
before { request_show }
|
||||||
|
|
||||||
@ -17,5 +18,15 @@ describe 'API sounds' do
|
|||||||
it 'returns the sound file as the body' do
|
it 'returns the sound file as the body' do
|
||||||
expect(response.body).to eq File.read(sound.path, mode: 'rb')
|
expect(response.body).to eq File.read(sound.path, mode: 'rb')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when method is HEAD' do
|
||||||
|
let(:request_method) { :head }
|
||||||
|
|
||||||
|
it { is_expected.to have_http_status 200 }
|
||||||
|
|
||||||
|
it 'returns an empty body' do
|
||||||
|
expect(response.body).to be_empty
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user