File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ def include_foo!
42
42
43
43
it 'does not include extra fields when not requested' do
44
44
get :index
45
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name last-name ) )
45
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name last_name ) )
46
46
end
47
47
48
48
it 'includes the extra fields in the response when requested' do
49
49
get :index , params : { extra_fields : { authors : 'net_worth' } }
50
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name last-name net-worth ) )
50
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name last_name net_worth ) )
51
51
end
52
52
53
53
it 'alters the scope based on the supplied block' do
@@ -63,7 +63,7 @@ def include_foo!
63
63
64
64
it 'does not include the extra field in the response' do
65
65
get :index , params : { extra_fields : { authors : 'net_worth' } }
66
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name last-name ) )
66
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name last_name ) )
67
67
end
68
68
end
69
69
end
Original file line number Diff line number Diff line change @@ -34,17 +34,17 @@ def current_user
34
34
35
35
it 'limits to only the requested fields' do
36
36
get :index
37
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name last-name uuid ) )
37
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name last_name uuid ) )
38
38
get :index , params : { fields : { authors : 'first_name,last_name' } }
39
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name last-name ) )
39
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name last_name ) )
40
40
end
41
41
42
42
it 'disallows fields guarded by :if, even if specified' do
43
43
allow ( controller ) . to receive ( :current_user ) { 'admin' }
44
44
get :index , params : { fields : { authors : 'first_name,salary' } }
45
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name salary ) )
45
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name salary ) )
46
46
allow ( controller ) . to receive ( :current_user ) { 'non-admin' }
47
47
get :index , params : { fields : { authors : 'first_name,salary' } }
48
- expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first-name ) )
48
+ expect ( json_items ( 0 ) . keys ) . to match_array ( %w( id jsonapi_type first_name ) )
49
49
end
50
50
end
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def index
44
44
. once
45
45
. and_call_original
46
46
get :index
47
- expect ( json_items ( 0 ) [ 'first-name ' ] ) . to eq ( 'Stephen' )
47
+ expect ( json_items ( 0 ) [ 'first_name ' ] ) . to eq ( 'Stephen' )
48
48
end
49
49
end
50
50
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def index
23
23
context 'when passing sort param' do
24
24
subject do
25
25
get :index , params : { sort : sort_param }
26
- json_items . map { |n | n [ 'first-name ' ] }
26
+ json_items . map { |n | n [ 'first_name ' ] }
27
27
end
28
28
29
29
context 'asc' do
You can’t perform that action at this time.
0 commit comments