|
14 | 14 | # File.delete('test.db') if File.exists?('test.db') |
15 | 15 | # end |
16 | 16 | # |
17 | | -# include RDF_Repository |
| 17 | +# it_behaves_like 'an RDF::Repository' |
18 | 18 | # end |
19 | 19 | #end |
20 | | -module RDF_Durable |
21 | | - extend RSpec::SharedContext |
| 20 | +RSpec.shared_examples 'an RDF::Durable' do |
22 | 21 | include RDF::Spec::Matchers |
23 | 22 |
|
24 | 23 | before :each do |
25 | | - raise '+@load_durable+ must be defined in a before(:each) block' unless instance_variable_get('@load_durable') |
| 24 | + raise '+@load_durable+ must be defined in a before(:each) block' unless |
| 25 | + instance_variable_get('@load_durable') |
26 | 26 | end |
27 | 27 |
|
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} |
34 | 29 |
|
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 |
| 41 | + |
| 42 | + its(:nondurable?) {should_not == subject.durable?} |
40 | 43 |
|
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 |
| 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 |
46 | 48 | end |
47 | 49 | end |
48 | 50 | 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 | + def self.included(mod) |
| 59 | + warn "[DEPRECATION] `RDF_Durable` is deprecated. "\ |
| 60 | + "Please use `it_behaves_like 'an RDF::Durable'`" |
| 61 | + end |
| 62 | + |
| 63 | + describe 'examples for' do |
| 64 | + include_examples 'an RDF::Durable' |
| 65 | + end |
| 66 | +end |
0 commit comments