Sha256: 7632c4fc963288face6b633e908d366408abcc0edc17e12c4936cde9a263f0bf
Contents?: true
Size: 1.01 KB
Versions: 11
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true describe ErrorController, type: :controller do describe '#show' do context 'when request error code 10' do let(:code) { 10 } let(:expected_response) do { error: { code: code, message: 'You requested error code: 10', }, }.to_json end it 'returns 400 Bad request with error code 10' do get '/error/:code', code: code expect(response.status).to eq 400 expect(response.body).to eq expected_response end end context 'when request error code 20' do let(:code) { 20 } let(:expected_response) do { error: { code: code, message: 'You requested error code: 20', }, }.to_json end it 'returns 400 Bad request with error code 20' do get '/error/:code', code: code expect(response.status).to eq 400 expect(response.body).to eq expected_response end end end end
Version data entries
11 entries across 11 versions & 1 rubygems