We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 177e1d8 commit 2162b92Copy full SHA for 2162b92
lib/jsonapi/rspec/id.rb
@@ -3,7 +3,7 @@ module RSpec
3
module Id
4
::RSpec::Matchers.define :have_id do |expected|
5
match do |actual|
6
- JSONAPI::RSpec.as_indifferent_hash(actual)['id'] == expected
+ JSONAPI::RSpec.as_indifferent_hash(actual)['id'].to_s == expected.to_s
7
end
8
9
spec/jsonapi/id_spec.rb
@@ -5,6 +5,14 @@
expect('id' => 'foo').to have_id('foo')
+ it 'succeeds when expectation is integer' do
+ expect('id' => '123').to have_id(123)
10
+ end
11
+
12
+ it 'succeeds when id is symbol' do
13
+ expect('id' => :foo).to have_id('foo')
14
15
16
it 'fails when id mismatches' do
17
expect('id' => 'foo').not_to have_id('bar')
18
0 commit comments