rdf-spec 1.1.0 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README +1 -1
  3. data/VERSION +1 -1
  4. data/lib/rdf/spec/reader.rb +55 -19
  5. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55b304bd99801d0dff43b5fc240bb1d8feb1b3cf
4
- data.tar.gz: d7513635a1111bf62e220aa65b7e5e46852a80d6
3
+ metadata.gz: df117f1cce44a55d080d654e85980089884ca93d
4
+ data.tar.gz: 4705ee929ae8d15f6c5301bb2aee44ddbff6c8b3
5
5
  SHA512:
6
- metadata.gz: bdd77291081628c58b77b65eb7b0bf293e8b2a077c24b0bca4a486a9322c78227fc6328b9a36c71c415ea68674fd8a0b743e838d1f15be2130389a85fa9a920f
7
- data.tar.gz: 0bdb0547949d73aa6f49d8d471c7cbf1b8db89836683cb3b6fa23be9d46e6ee18737df1ea04da301d9dbd2be79d706c7076d5165b7fcf73b5c1d52927ec23874
6
+ metadata.gz: aa2a2135b703fa0c1e13831d10da184a96763767758c036123ad12caaaf93e6f2dc89fe7a6cb159323381a752dc8b4531391c5699d831e977cadc7f78bb3fa22
7
+ data.tar.gz: cfe5fed490a8daf14fa01fc503791dd8f0938ea6dc2f17b1863258817c76d36a027afbc1308efc0feb4b14db36c9e956d9819bcdf1031e48cc1787383af7063c
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  # RSpec Extensions for RDF.rb
2
2
 
3
- This is an [RDF.rb][] plugin that provides RDF-specific [RSpec][] matchers
3
+ This is an [RDF.rb][] extension that provides RDF-specific [RSpec][] matchers
4
4
  and shared examples for Ruby projects that use RDF.rb and RSpec.
5
5
 
6
6
  * <http://github.com/ruby-rdf/rdf-spec>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.3
@@ -6,6 +6,8 @@ module RDF_Reader
6
6
 
7
7
  before(:each) do
8
8
  raise '+@reader+ must be defined in a before(:each) block' unless instance_variable_get('@reader')
9
+ raise '+@reader_input+ must be defined in a before(:each) block' unless instance_variable_get('@reader_input')
10
+ raise '+@reader_count+ must be defined in a before(:each) block' unless instance_variable_get('@reader_count')
9
11
  @reader_class = @reader.class
10
12
  end
11
13
 
@@ -20,12 +22,11 @@ module RDF_Reader
20
22
 
21
23
  describe ".open" do
22
24
  before(:each) do
23
- RDF::Util::File.stub(:open_file).and_yield(StringIO.new("foo"))
25
+ RDF::Util::File.stub(:open_file).and_yield(StringIO.new(@reader_input))
24
26
  end
25
27
 
26
28
  it "yields reader given file_name" do
27
29
  @reader_class.format.each do |f|
28
- RDF::Util::File.stub(:open_file).and_yield(StringIO.new("foo"))
29
30
  f.file_extensions.each_pair do |sym, content_type|
30
31
  reader_mock = double("reader")
31
32
  expect(reader_mock).to receive(:got_here)
@@ -40,7 +41,6 @@ module RDF_Reader
40
41
 
41
42
  it "yields reader given symbol" do
42
43
  @reader_class.format.each do |f|
43
- RDF::Util::File.stub(:open_file).and_yield(StringIO.new("foo"))
44
44
  sym = f.to_sym # Like RDF::NTriples::Format => :ntriples
45
45
  reader_mock = double("reader")
46
46
  expect(reader_mock).to receive(:got_here)
@@ -54,7 +54,6 @@ module RDF_Reader
54
54
 
55
55
  it "yields reader given {:file_name => file_name}" do
56
56
  @reader_class.format.each do |f|
57
- RDF::Util::File.stub(:open_file).and_yield(StringIO.new("foo"))
58
57
  f.file_extensions.each_pair do |sym, content_type|
59
58
  reader_mock = double("reader")
60
59
  expect(reader_mock).to receive(:got_here)
@@ -69,7 +68,6 @@ module RDF_Reader
69
68
 
70
69
  it "yields reader given {:content_type => 'a/b'}" do
71
70
  @reader_class.format.each do |f|
72
- RDF::Util::File.stub(:open_file).and_yield(StringIO.new("foo"))
73
71
  f.content_types.each_pair do |content_type, formats|
74
72
  reader_mock = double("reader")
75
73
  expect(reader_mock).to receive(:got_here)
@@ -94,37 +92,32 @@ module RDF_Reader
94
92
  it "sets @input to StringIO given a string" do
95
93
  reader_mock = double("reader")
96
94
  expect(reader_mock).to receive(:got_here)
97
- @reader_class.new("string") do |r|
95
+ @reader_class.new(@reader_input) do |r|
98
96
  reader_mock.got_here
99
97
  expect(r.instance_variable_get(:@input)).to be_a(StringIO)
100
98
  end
101
99
  end
102
-
100
+
103
101
  it "sets @input to input given something other than a string" do
104
102
  reader_mock = double("reader")
105
103
  expect(reader_mock).to receive(:got_here)
106
- file = StringIO.new("")
104
+ file = StringIO.new(@reader_input)
107
105
  @reader_class.new(file) do |r|
108
106
  reader_mock.got_here
109
107
  expect(r.instance_variable_get(:@input)).to eq file
110
108
  end
111
109
  end
112
-
110
+
113
111
  it "sets validate given :validate => true" do
114
- # Either set validate, or through error, due to invalid input (null input may be invalid)
115
- begin
116
- @reader_class.new("string", :validate => true) do |r|
117
- expect(r).to be_valid
118
- end
119
- rescue
120
- expect($!).to be_a(RDF::ReaderError) # An error is acceptable
112
+ @reader_class.new(@reader_input, :validate => true) do |r|
113
+ expect(r).to be_valid
121
114
  end
122
115
  end
123
116
 
124
117
  it "sets canonicalize given :canonicalize => true" do
125
118
  reader_mock = double("reader")
126
119
  expect(reader_mock).to receive(:got_here)
127
- @reader_class.new("string", :canonicalize => true) do |r|
120
+ @reader_class.new(@reader_input, :canonicalize => true) do |r|
128
121
  reader_mock.got_here
129
122
  expect(r).to be_canonicalize
130
123
  end
@@ -133,7 +126,7 @@ module RDF_Reader
133
126
  it "sets intern given :intern => true" do
134
127
  reader_mock = double("reader")
135
128
  expect(reader_mock).to receive(:got_here)
136
- @reader_class.new("string", :intern => true) do |r|
129
+ @reader_class.new(@reader_input, :intern => true) do |r|
137
130
  reader_mock.got_here
138
131
  expect(r).to be_intern
139
132
  end
@@ -142,7 +135,7 @@ module RDF_Reader
142
135
  it "sets prefixes given :prefixes => {}" do
143
136
  reader_mock = double("reader")
144
137
  expect(reader_mock).to receive(:got_here)
145
- @reader_class.new("string", :prefixes => {:a => "b"}) do |r|
138
+ @reader_class.new(@reader_input, :prefixes => {:a => "b"}) do |r|
146
139
  reader_mock.got_here
147
140
  expect(r.prefixes).to eq({:a => "b"})
148
141
  end
@@ -168,5 +161,48 @@ module RDF_Reader
168
161
  end
169
162
  end
170
163
  end
164
+
165
+ context RDF::Enumerable do
166
+ it "#count" do
167
+ @reader_class.new(@reader_input) {|r| expect(r.count).to eq @reader_count}
168
+ end
169
+ it "#empty?" do
170
+ @reader_class.new(@reader_input) {|r| expect(r).not_to be_empty}
171
+ end
172
+
173
+ it "#statements" do
174
+ @reader_class.new(@reader_input) {|r| expect(r.statements.count).to eq @reader_count}
175
+ end
176
+ it "#has_statement?" do
177
+ @reader_class.new(@reader_input) {|r| expect(r).to respond_to(:has_statement?)}
178
+ end
179
+ it "#each_statement" do
180
+ @reader_class.new(@reader_input) {|r| expect(r.each_statement.count).to eq @reader_count}
181
+ end
182
+ it "#enum_statement" do
183
+ @reader_class.new(@reader_input) {|r| expect(r.enum_statement.count).to eq @reader_count}
184
+ end
185
+
186
+ it "#triples" do
187
+ @reader_class.new(@reader_input) {|r| expect(r.triples.count).to eq @reader_count}
188
+ end
189
+ it "#each_triple" do
190
+ @reader_class.new(@reader_input) {|r| expect(r.each_triple.count).to eq @reader_count}
191
+ end
192
+ it "#enum_triple" do
193
+ @reader_class.new(@reader_input) {|r| expect(r.enum_triple.count).to eq @reader_count}
194
+ end
195
+
196
+ it "#quads" do
197
+ @reader_class.new(@reader_input) {|r| expect(r.quads.count).to eq @reader_count}
198
+ end
199
+ it "#each_quad" do
200
+ @reader_class.new(@reader_input) {|r| expect(r.each_quad.count).to eq @reader_count}
201
+ end
202
+ it "#enum_quad" do
203
+ @reader_class.new(@reader_input) {|r| expect(r.enum_quad.count).to eq @reader_count}
204
+ end
205
+
206
+ end
171
207
  end
172
208
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-12 00:00:00.000000000 Z
13
+ date: 2014-04-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf
@@ -30,32 +30,32 @@ dependencies:
30
30
  name: rspec
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ~>
34
34
  - !ruby/object:Gem::Version
35
35
  version: '2.14'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
42
  version: '2.14'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: yard
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ~>
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0.8'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0.8'
57
- description: RDF.rb plugin that provides RSpec matchers and shared examples for RDF
58
- objects.
57
+ description: RDF.rb extension that provides RSpec matchers and shared examples for
58
+ RDF objects.
59
59
  email: public-rdf-ruby@w3.org
60
60
  executables: []
61
61
  extensions: []
@@ -73,6 +73,7 @@ files:
73
73
  - etc/quads.nq
74
74
  - etc/test-data.nt
75
75
  - etc/triples.nt
76
+ - lib/rdf/spec.rb
76
77
  - lib/rdf/spec/countable.rb
77
78
  - lib/rdf/spec/durable.rb
78
79
  - lib/rdf/spec/enumerable.rb
@@ -89,7 +90,6 @@ files:
89
90
  - lib/rdf/spec/version.rb
90
91
  - lib/rdf/spec/writable.rb
91
92
  - lib/rdf/spec/writer.rb
92
- - lib/rdf/spec.rb
93
93
  - spec/spec_helper.rb
94
94
  - spec/version_spec.rb
95
95
  homepage: http://ruby-rdf.github.com/rdf-spec/
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project: rdf
115
- rubygems_version: 2.1.11
115
+ rubygems_version: 2.2.2
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: RSpec extensions for RDF.rb.