|
41 | 41 | end |
42 | 42 | end |
43 | 43 |
|
44 | | - if options[:action] == :index |
45 | | - context 'when error is at "filter" param' do |
46 | | - options.merge!( |
47 | | - params: { filter: { foo: 'bar' } }, |
48 | | - expect: { title: 'Filter not allowed', code: 102 } |
49 | | - ) |
50 | | - it_behaves_like '400 response', options |
51 | | - end |
| 44 | + context 'when error is at "filter" param' do |
| 45 | + options.merge!( |
| 46 | + params: { filter: { foo: 'bar' } }, |
| 47 | + expect: { title: 'Filter not allowed', code: 102 } |
| 48 | + ) |
| 49 | + it_behaves_like '400 response', options |
| 50 | + end |
52 | 51 |
|
53 | | - context 'when error is at "sort" param' do |
54 | | - options.merge!( |
55 | | - params: { sort: 'foo' }, |
56 | | - expect: { title: 'Invalid sort criteria', code: 114 } |
57 | | - ) |
58 | | - it_behaves_like '400 response', options |
59 | | - end |
| 52 | + context 'when error is at "sort" param' do |
| 53 | + options.merge!( |
| 54 | + params: { sort: 'foo' }, |
| 55 | + expect: { title: 'Invalid sort criteria', code: 114 } |
| 56 | + ) |
| 57 | + it_behaves_like '400 response', options |
| 58 | + end |
60 | 59 |
|
61 | | - context 'when error is at "page" param' do |
62 | | - %i(number size).each do |field| |
63 | | - context 'with invalid "number"' do |
64 | | - options.merge!( |
65 | | - params: { page: { "#{field}": 'foo' } }, |
66 | | - expect: { title: 'Invalid page value', code: 118 } |
67 | | - ) |
68 | | - it_behaves_like '400 response', options |
69 | | - end |
70 | | - end |
71 | | - end |
72 | | - elsif !options[:record].nil? |
73 | | - context 'with a not found record' do |
74 | | - it 'renders 404 response' do |
75 | | - get :show, options[:record] |
76 | | - expect(response).to have_http_status :not_found |
| 60 | + context 'when error is at "page" param' do |
| 61 | + %i(number size).each do |field| |
| 62 | + context 'with invalid "number"' do |
| 63 | + options.merge!( |
| 64 | + params: { page: { "#{field}": 'foo' } }, |
| 65 | + expect: { title: 'Invalid page value', code: 118 } |
| 66 | + ) |
| 67 | + it_behaves_like '400 response', options |
77 | 68 | end |
78 | 69 | end |
79 | 70 | end |
|
0 commit comments