Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/jsonapi/rspec/id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module RSpec
module Id
::RSpec::Matchers.define :have_id do |expected|
match do |actual|
JSONAPI::RSpec.as_indifferent_hash(actual)['id'] == expected
JSONAPI::RSpec.as_indifferent_hash(actual)['id'] == expected.to_s
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/jsonapi/id_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
expect('id' => 'foo').to have_id('foo')
end

it 'succeeds when expectation is integer' do
expect('id' => '123').to have_id(123)
end

it 'fails when id mismatches' do
expect('id' => 'foo').not_to have_id('bar')
end
Expand Down