Skip to content

Commit 454e3bd

Browse files
author
Tom Johnson
committed
Deprecate old style SharedContext examples
This commit can be reverted to remove the deprecations.
1 parent 9b2026e commit 454e3bd

15 files changed

Lines changed: 383 additions & 103 deletions

lib/rdf/spec/countable.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,23 @@
4545
end
4646
end
4747
end
48+
49+
##
50+
# @deprecated use `it_behaves_like "an RDF::Countable"` instead
51+
module RDF_Countable
52+
extend RSpec::SharedContext
53+
include RDF::Spec::Matchers
54+
55+
warn "[DEPRECATION] `RDF_Countable` is deprecated. "\
56+
"Please use `it_behaves_like 'an RDF::Countable'`"
57+
58+
describe 'examples for' do
59+
include_examples 'an RDF::Countable' do
60+
let(:countable) { @countable }
61+
62+
before do
63+
raise '@countable must be defined' unless defined?(countable)
64+
end
65+
end
66+
end
67+
end

lib/rdf/spec/durable.rb

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,40 @@
2525
instance_variable_get('@load_durable')
2626
end
2727

28-
describe RDF::Durable do
29-
subject {@load_durable.call}
30-
it {should respond_to(:durable?)}
31-
it "should support #durable?" do
32-
expect([true,false]).to be_member(subject.durable?)
33-
end
28+
subject {@load_durable.call}
3429

35-
it {should respond_to(:nondurable?)}
36-
it "should support #nondurable?" do
37-
expect([true,false]).to be_member(@load_durable.call.nondurable?)
38-
end
39-
its(:nondurable?) {should_not == subject.durable?}
30+
it { should respond_to(:durable?) }
31+
32+
it "should support #durable?" do
33+
expect([true,false]).to be_member(subject.durable?)
34+
end
35+
36+
it {should respond_to(:nondurable?)}
37+
38+
it "should support #nondurable?" do
39+
expect([true,false]).to be_member(@load_durable.call.nondurable?)
40+
end
4041

41-
it "should save contents between instantiations" do
42-
if subject.durable?
43-
subject.load(RDF::Spec::TRIPLES_FILE)
44-
expect(subject.count).to eq File.readlines(RDF::Spec::TRIPLES_FILE).size
45-
end
42+
its(:nondurable?) {should_not == subject.durable?}
43+
44+
it "should save contents between instantiations" do
45+
if subject.durable?
46+
subject.load(RDF::Spec::TRIPLES_FILE)
47+
expect(subject.count).to eq File.readlines(RDF::Spec::TRIPLES_FILE).size
4648
end
4749
end
4850
end
51+
52+
##
53+
# @deprecated use `it_behaves_like "an RDF::Durable"` instead
54+
module RDF_Durable
55+
extend RSpec::SharedContext
56+
include RDF::Spec::Matchers
57+
58+
warn "[DEPRECATION] `RDF_Durable` is deprecated. "\
59+
"Please use `it_behaves_like 'an RDF::Durable'`"
60+
61+
describe 'examples for' do
62+
include_examples 'an RDF::Durable'
63+
end
64+
end

lib/rdf/spec/enumerable.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,23 @@
468468
end
469469
end
470470
end
471+
472+
##
473+
# @deprecated use `it_behaves_like "an RDF::Enumerable"` instead
474+
module RDF_Enumerable
475+
extend RSpec::SharedContext
476+
include RDF::Spec::Matchers
477+
478+
warn "[DEPRECATION] `RDF_Enumerable` is deprecated. "\
479+
"Please use `it_behaves_like 'an RDF::Enumerable'`"
480+
481+
describe 'examples for' do
482+
include_examples 'an RDF::Enumerable' do
483+
let(:enumerable) { @enumerable }
484+
485+
before do
486+
raise '@enumerable must be defined' unless defined?(enumerable)
487+
end
488+
end
489+
end
490+
end

lib/rdf/spec/format.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,23 @@
5151
end
5252
end
5353
end
54+
55+
##
56+
# @deprecated use `it_behaves_like "an RDF::Format"` instead
57+
module RDF_Format
58+
extend RSpec::SharedContext
59+
include RDF::Spec::Matchers
60+
61+
warn "[DEPRECATION] `RDF_Format` is deprecated. "\
62+
"Please use `it_behaves_like 'an RDF::Format'`"
63+
64+
describe 'examples for' do
65+
include_examples 'an RDF::Format' do
66+
let(:format_class) { @format_class }
67+
68+
before do
69+
raise '@format_class must be defined' unless defined?(format_class)
70+
end
71+
end
72+
end
73+
end

lib/rdf/spec/http_adapter.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,23 @@
269269
end
270270

271271
end
272+
273+
##
274+
# @deprecated use `it_behaves_like "an RDF::HttpAdapter"` instead
275+
module RDF_HttpAdapter
276+
extend RSpec::SharedContext
277+
include RDF::Spec::Matchers
278+
279+
warn "[DEPRECATION] `RDF_HttpAdapter` is deprecated. "\
280+
"Please use `it_behaves_like 'an RDF::HttpAdapter'`"
281+
282+
describe 'examples for' do
283+
include_examples 'an RDF::HttpAdapter' do
284+
let(:http_adapter) { @http_adapter }
285+
286+
before do
287+
raise '@http_adapter must be defined' unless defined?(http_adapter)
288+
end
289+
end
290+
end
291+
end

lib/rdf/spec/indexable.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,23 @@
2323
end
2424

2525
end
26+
27+
##
28+
# @deprecated use `it_behaves_like "an RDF::Indexable"` instead
29+
module RDF_Indexable
30+
extend RSpec::SharedContext
31+
include RDF::Spec::Matchers
32+
33+
warn "[DEPRECATION] `RDF_Indexable` is deprecated. "\
34+
"Please use `it_behaves_like 'an RDF::Indexable'`"
35+
36+
describe 'examples for' do
37+
include_examples 'an RDF::Indexable' do
38+
let(:indexable) { @indexable }
39+
40+
before do
41+
raise '@indexable must be defined' unless defined?(indexable)
42+
end
43+
end
44+
end
45+
end

lib/rdf/spec/inferable.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,17 @@
55

66
it "should implement specs" #TODO
77
end
8+
9+
##
10+
# @deprecated use `it_behaves_like "an RDF::Inferable"` instead
11+
module RDF_Inferable
12+
extend RSpec::SharedContext
13+
include RDF::Spec::Matchers
14+
15+
warn "[DEPRECATION] `RDF_Inferable` is deprecated. "\
16+
"Please use `it_behaves_like 'an RDF::Inferable'`"
17+
18+
describe 'examples for' do
19+
include_examples 'an RDF::Inferable'
20+
end
21+
end

lib/rdf/spec/mutable.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,23 @@
143143
end
144144
end
145145
end
146+
147+
##
148+
# @deprecated use `it_behaves_like "an RDF::Mutable"` instead
149+
module RDF_Mutable
150+
extend RSpec::SharedContext
151+
include RDF::Spec::Matchers
152+
153+
warn "[DEPRECATION] `RDF_Mutable` is deprecated. "\
154+
"Please use `it_behaves_like 'an RDF::Mutable'`"
155+
156+
describe 'examples for' do
157+
include_examples 'an RDF::Mutable' do
158+
let(:mutable) { @mutable }
159+
160+
before do
161+
raise '@mutable must be defined' unless defined?(mutable)
162+
end
163+
end
164+
end
165+
end

lib/rdf/spec/queryable.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,23 @@
527527
end
528528
end
529529
end
530+
531+
##
532+
# @deprecated use `it_behaves_like "an RDF::Queryable"` instead
533+
module RDF_Queryable
534+
extend RSpec::SharedContext
535+
include RDF::Spec::Matchers
536+
537+
warn "[DEPRECATION] `RDF_Queryable` is deprecated. "\
538+
"Please use `it_behaves_like 'an RDF::Queryable'`"
539+
540+
describe 'examples for' do
541+
include_examples 'an RDF::Queryable' do
542+
let(:queryable) { @queryable }
543+
544+
before do
545+
raise '@queryable must be defined' unless defined?(queryable)
546+
end
547+
end
548+
end
549+
end

lib/rdf/spec/readable.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,23 @@
1515
its(:readable?) { is_expected.to eq subject.readable? }
1616
end
1717
end
18+
19+
##
20+
# @deprecated use `it_behaves_like "an RDF::Readable"` instead
21+
module RDF_Readable
22+
extend RSpec::SharedContext
23+
include RDF::Spec::Matchers
24+
25+
warn "[DEPRECATION] `RDF_Readable` is deprecated. "\
26+
"Please use `it_behaves_like 'an RDF::Readable'`"
27+
28+
describe 'examples for' do
29+
include_examples 'an RDF::Readable' do
30+
let(:readable) { @readable }
31+
32+
before do
33+
raise '@readable must be defined' unless defined?(readable)
34+
end
35+
end
36+
end
37+
end

0 commit comments

Comments
 (0)