Skip to content

Commit 265d2ed

Browse files
committed
Add string key tests to attributes and links matchers
For consistency, as all other specs now contain tests for symbols and strings, added string tests into the attributes and links specs.
1 parent 569cd6a commit 265d2ed

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Diff for: spec/jsonapi/attributes_spec.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@
1111

1212
describe '#have_attribute' do
1313
it { expect(doc).to have_attribute(:one) }
14+
it { expect(doc).to have_attribute('one') }
1415
it { expect(doc).not_to have_attribute(:five) }
16+
it { expect(doc).not_to have_attribute('five') }
1517
end
1618

1719
describe '#have_jsonapi_attributes' do
1820
it { expect(doc).to have_jsonapi_attributes(:one, :two) }
21+
it { expect(doc).to have_jsonapi_attributes('one', 'two') }
1922
it { expect(doc).not_to have_jsonapi_attributes(:two, :five) }
23+
it { expect(doc).not_to have_jsonapi_attributes('two', 'five') }
2024
it { expect(doc).to have_jsonapi_attributes(:one, :two, :four).exactly }
21-
it { expect(doc).not_to have_jsonapi_attributes(:one).exactly }
25+
it { expect(doc).to have_jsonapi_attributes('one', 'two', 'four').exactly }
26+
it { expect(doc).not_to have_jsonapi_attributes('one').exactly }
27+
it { expect(doc).not_to have_jsonapi_attributes('one').exactly }
2228
end
2329
end

Diff for: spec/jsonapi/links_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@
1111
context '#have_link' do
1212
it { expect(doc).to have_link(:self) }
1313
it { expect(doc).to have_link(:self).with_value('self_link') }
14+
it { expect(doc).to have_link('self') }
15+
it { expect(doc).to have_link('self').with_value('self_link') }
1416
it { expect(doc).not_to have_link(:self).with_value('any_link') }
1517
it { expect(doc).not_to have_link(:any) }
18+
it { expect(doc).not_to have_link('self').with_value('any_link') }
19+
it { expect(doc).not_to have_link('any') }
1620
end
1721

1822
context '#have_links' do
1923
it { expect(doc).to have_links(:self, :related) }
2024
it { expect(doc).not_to have_links(:self, :other) }
25+
it { expect(doc).to have_links('self', 'related') }
26+
it { expect(doc).not_to have_links('self', 'other') }
2127
end
2228
end

0 commit comments

Comments
 (0)