Skip to content

Commit

Permalink
HOTT-4629: Fix pages_controller_spec tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdesi committed Dec 21, 2023
1 parent cd2bb3e commit 5445c5f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/requests/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,21 @@
context 'when howto does not exist' do
let(:howto) { 'non-existent' }

it { expect { do_request }.to raise_error(ActionController::RoutingError) }
it { expect(do_request).to have_http_status(:not_found) }
end

context 'when howto format is html' do
let(:howto) { 'origin.html' }

it { expect { do_request }.not_to raise_error }
it { expect(do_request.body).to include 'What is origin?' }
end

context 'when howto format is not html' do
let(:howto) { 'origin.json' }

it { expect { do_request }.to raise_error(ActionController::RoutingError) }
it 'returns resource not found' do
expect(JSON.parse(do_request.body)).to eq('error' => 'Resource not found')
end
end
end
end

0 comments on commit 5445c5f

Please sign in to comment.