|
3 | 3 | RSpec.shared_examples 'an RDF::Countable' do |
4 | 4 | include RDF::Spec::Matchers |
5 | 5 |
|
| 6 | + let(:statements) {RDF::Spec.quads} |
6 | 7 | before do |
7 | 8 | raise 'countable must be set with `let(:countable)' unless |
8 | 9 | defined? countable |
9 | 10 |
|
10 | | - @statements = RDF::Spec.quads |
11 | | - |
12 | 11 | if countable.empty? |
13 | 12 | if (countable.writable? rescue false) |
14 | | - countable.send(:insert_statements, @statements) |
| 13 | + countable.send(:insert_statements, statements) |
15 | 14 | elsif countable.respond_to?(:<<) |
16 | | - @statements.each { |statement| countable << statement } |
| 15 | + statements.each { |statement| countable << statement } |
17 | 16 | else |
18 | 17 | raise "+countable+ must respond to #<< or be pre-populated with the" \ |
19 | 18 | "statements in #{RDF::Spec::TRIPLES_FILE} in a before block" |
|
27 | 26 | it {is_expected.to respond_to(:empty?)} |
28 | 27 | it {is_expected.to_not be_empty} |
29 | 28 | it {is_expected.to respond_to(:count)} |
30 | | - its(:count) {is_expected.to eq @statements.size} |
| 29 | + its(:count) {is_expected.to eq statements.size} |
31 | 30 | it {is_expected.to respond_to(:size)} |
32 | | - its(:size) {is_expected.to eq @statements.size} |
| 31 | + its(:size) {is_expected.to eq statements.size} |
33 | 32 |
|
34 | 33 | context "when empty" do |
35 | 34 | subject {[].extend(RDF::Countable)} |
|
45 | 44 | end |
46 | 45 | end |
47 | 46 | 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 | | - def self.included(mod) |
56 | | - warn "[DEPRECATION] `RDF_Countable` is deprecated. "\ |
57 | | - "Please use `it_behaves_like 'an RDF::Countable'`" |
58 | | - end |
59 | | - |
60 | | - describe 'examples for' do |
61 | | - include_examples 'an RDF::Countable' do |
62 | | - let(:countable) { @countable } |
63 | | - |
64 | | - before do |
65 | | - raise '@countable must be defined' unless defined?(countable) |
66 | | - end |
67 | | - end |
68 | | - end |
69 | | -end |
0 commit comments