Skip to content

Commit e99c542

Browse files
author
Lee Richmond
committed
fix specs
1 parent 8ef5538 commit e99c542

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

spec/extra_fields_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ def include_foo!
4242

4343
it 'does not include extra fields when not requested' do
4444
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))
4646
end
4747

4848
it 'includes the extra fields in the response when requested' do
4949
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))
5151
end
5252

5353
it 'alters the scope based on the supplied block' do
@@ -63,7 +63,7 @@ def include_foo!
6363

6464
it 'does not include the extra field in the response' do
6565
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))
6767
end
6868
end
6969
end

spec/fields_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ def current_user
3434

3535
it 'limits to only the requested fields' do
3636
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))
3838
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))
4040
end
4141

4242
it 'disallows fields guarded by :if, even if specified' do
4343
allow(controller).to receive(:current_user) { 'admin' }
4444
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))
4646
allow(controller).to receive(:current_user) { 'non-admin' }
4747
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))
4949
end
5050
end

spec/jsonapi_compliable_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def index
4444
.once
4545
.and_call_original
4646
get :index
47-
expect(json_items(0)['first-name']).to eq('Stephen')
47+
expect(json_items(0)['first_name']).to eq('Stephen')
4848
end
4949
end
5050

spec/sorting_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def index
2323
context 'when passing sort param' do
2424
subject do
2525
get :index, params: { sort: sort_param }
26-
json_items.map { |n| n['first-name'] }
26+
json_items.map { |n| n['first_name'] }
2727
end
2828

2929
context 'asc' do

0 commit comments

Comments
 (0)