rdf-spec 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS ADDED
@@ -0,0 +1,2 @@
1
+ * Arto Bendiken <arto.bendiken@gmail.com>
2
+ * Ben Lavender <blavender@gmail.com>
data/README ADDED
@@ -0,0 +1,54 @@
1
+ RSpec Extensions for RDF.rb
2
+ ===========================
3
+
4
+ This is an [RDF.rb][] plugin that provides RDF-specific [RSpec][] matchers
5
+ and shared examples for Ruby projects that use RDF.rb and RSpec.
6
+
7
+ * <http://github.com/bendiken/rdf-spec>
8
+
9
+ Documentation
10
+ -------------
11
+
12
+ * {RDF::Spec}
13
+ * {RDF::Spec::Matchers}
14
+
15
+ Dependencies
16
+ ------------
17
+
18
+ * [RDF.rb](http://gemcutter.org/gems/rdf) (>= 0.0.9)
19
+ * [RSpec](http://gemcutter.org/gems/rspec) (>= 1.2.9)
20
+
21
+ Installation
22
+ ------------
23
+
24
+ The recommended installation method is via RubyGems. To install the latest
25
+ official release from Gemcutter, do:
26
+
27
+ % [sudo] gem install rdf-spec
28
+
29
+ Download
30
+ --------
31
+
32
+ To get a local working copy of the development repository, do:
33
+
34
+ % git clone git://github.com/bendiken/rdf-spec.git
35
+
36
+ Alternatively, you can download the latest development version as a tarball
37
+ as follows:
38
+
39
+ % wget http://github.com/bendiken/rdf-spec/tarball/master
40
+
41
+ Author
42
+ ------
43
+
44
+ * [Arto Bendiken](mailto:arto.bendiken@gmail.com) - <http://ar.to/>
45
+ * [Ben Lavender](mailto:blavender@gmail.com) - <http://bhuga.net/>
46
+
47
+ License
48
+ -------
49
+
50
+ `RDF::Spec` is free and unencumbered public domain software. For more
51
+ information, see <http://unlicense.org/> or the accompanying UNLICENSE file.
52
+
53
+ [RDF.rb]: http://rdf.rubyforge.org/
54
+ [RSpec]: http://rspec.info/
data/UNLICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.9
data/etc/doap.nt ADDED
@@ -0,0 +1,24 @@
1
+ <http://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
2
+ <http://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <http://gemcutter.org/gems/rdf> .
3
+ <http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto.bendiken@gmail.com> .
4
+ <http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" .
5
+ <http://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
6
+ <http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> .
7
+ <http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" .
8
+ <http://gemcutter.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self> .
9
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://ar.to/> .
10
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#bug-database> <http://github.com/bendiken/rdf/issues> .
11
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#created> "2007-10-23" .
12
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#description> "RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data."@en .
13
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
14
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://bhuga.net/#ben> .
15
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
16
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
17
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#homepage> <http://rdf.rubyforge.org/> .
18
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
19
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
20
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
21
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
22
+ <http://gemcutter.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
23
+ <http://gemcutter.org/gems/rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Project> .
24
+ <http://gemcutter.org/gems/rdf> <http://xmlns.com/foaf/0.1/maker> <http://ar.to/#self> .
data/lib/rdf/spec.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'rdf'
2
+
3
+ module RDF
4
+ ##
5
+ # **`RDF::Spec`** provides RSpec extensions for RDF.rb.
6
+ #
7
+ # @example Requiring the `RDF::Spec` module
8
+ # require 'rdf/spec'
9
+ #
10
+ # @example Including the matchers in `spec/spec_helper.rb`
11
+ # require 'rdf/spec'
12
+ #
13
+ # Spec::Runner.configure do |config|
14
+ # config.include(RDF::Spec::Matchers)
15
+ # end
16
+ #
17
+ # @example Using the shared examples for `RDF::Enumerable`
18
+ # require 'rdf/spec/enumerable'
19
+ #
20
+ # describe RDF::Enumerable do
21
+ # before :each do
22
+ # @statements = RDF::NTriples::Reader.new(File.open("etc/doap.nt")).to_a
23
+ # @enumerable = @statements.dup.extend(RDF::Enumerable)
24
+ # end
25
+ #
26
+ # it_should_behave_like RDF_Enumerable
27
+ # end
28
+ #
29
+ # @example Using the shared examples for `RDF::Repository`
30
+ # require 'rdf/spec/repository'
31
+ #
32
+ # describe RDF::Repository do
33
+ # before :each do
34
+ # @repository = RDF::Repository.new
35
+ # end
36
+ #
37
+ # it_should_behave_like RDF_Repository
38
+ # end
39
+ #
40
+ # @see http://rdf.rubyforge.org/
41
+ # @see http://rspec.info/
42
+ #
43
+ # @author [Arto Bendiken](http://ar.to/)
44
+ # @author [Ben Lavender](http://bhuga.net/)
45
+ module Spec
46
+ autoload :Matchers, 'rdf/spec/matchers'
47
+ autoload :VERSION, 'rdf/spec/version'
48
+ end # module Spec
49
+ end # module RDF
@@ -0,0 +1,249 @@
1
+ require 'rdf/spec'
2
+ require 'spec'
3
+
4
+ share_as :RDF_Enumerable do
5
+ include RDF::Spec::Matchers
6
+
7
+ before :each do
8
+ raise '+@enumerable+ must be defined in a before(:each) block' unless instance_variable_get('@enumerable')
9
+ raise '+@statements+ must be defined in a before(:each) block' unless instance_variable_get('@statements')
10
+ end
11
+
12
+ it "should support #empty?" do
13
+ @enumerable.respond_to?(:empty?).should be_true
14
+
15
+ ([].extend(RDF::Enumerable)).empty?.should be_true
16
+ @enumerable.empty?.should be_false
17
+ end
18
+
19
+ it "should support #count and #size" do
20
+ [:count, :size, :length].each do |method|
21
+ @enumerable.respond_to?(method).should be_true
22
+
23
+ @enumerable.send(method).should == @statements.size
24
+ end
25
+ end
26
+
27
+ context "statements" do
28
+ it "should support #statements" do
29
+ @enumerable.respond_to?(:statements).should be_true
30
+
31
+ @enumerable.statements.should be_instance_of(Array)
32
+ @enumerable.statements.size.should == @statements.size
33
+ @enumerable.statements.each { |statement| statement.should be_a_statement }
34
+ end
35
+
36
+ it "should support #has_statement?" do
37
+ @enumerable.respond_to?(:has_statement?).should be_true
38
+
39
+ @statements.each do |statement|
40
+ @enumerable.has_statement?(statement).should be_true
41
+ end
42
+
43
+ @enumerable.has_statement?([RDF::Node.new, RDF::URI.new("http://example.org/unknown"), RDF::Node.new]).should be_false
44
+ end
45
+
46
+ it "should support #each_statement" do
47
+ @enumerable.respond_to?(:each_statement).should be_true
48
+
49
+ @enumerable.each_statement.should be_instance_of(Enumerable::Enumerator)
50
+ @enumerable.each_statement { |statement| statement.should be_a_statement }
51
+ end
52
+
53
+ it "should support #enum_statement" do
54
+ @enumerable.respond_to?(:enum_statement).should be_true
55
+
56
+ @enumerable.enum_statement.should be_instance_of(Enumerable::Enumerator)
57
+ end
58
+ end
59
+
60
+ context "triples" do
61
+ it "should support #triples" do
62
+ @enumerable.respond_to?(:triples).should be_true
63
+
64
+ @enumerable.triples.should be_instance_of(Array)
65
+ @enumerable.triples.size.should == @statements.size
66
+ @enumerable.triples.each { |triple| triple.should be_a_triple }
67
+ end
68
+
69
+ it "should support #has_triple?" do
70
+ @enumerable.respond_to?(:has_triple?).should be_true
71
+
72
+ @statements.each do |statement|
73
+ @enumerable.has_triple?(statement.to_triple).should be_true
74
+ end
75
+ end
76
+
77
+ it "should support #each_triple" do
78
+ @enumerable.respond_to?(:each_triple).should be_true
79
+
80
+ @enumerable.each_triple.should be_instance_of(Enumerable::Enumerator)
81
+ @enumerable.each_triple { |*triple| triple.should be_a_triple }
82
+ end
83
+
84
+ it "should support #enum_triple" do
85
+ @enumerable.respond_to?(:enum_triple).should be_true
86
+
87
+ @enumerable.enum_triple.should be_instance_of(Enumerable::Enumerator)
88
+ end
89
+ end
90
+
91
+ context "quads" do
92
+ it "should support #quads" do
93
+ @enumerable.respond_to?(:quads).should be_true
94
+
95
+ @enumerable.quads.should be_instance_of(Array)
96
+ @enumerable.quads.size.should == @statements.size
97
+ @enumerable.quads.each { |quad| quad.should be_a_quad }
98
+ end
99
+
100
+ it "should support #has_quad?" do
101
+ @enumerable.respond_to?(:has_quad?).should be_true
102
+
103
+ @statements.each do |statement|
104
+ @enumerable.has_quad?(statement.to_quad).should be_true
105
+ end
106
+ end
107
+
108
+ it "should support #each_quad" do
109
+ @enumerable.respond_to?(:each_quad).should be_true
110
+
111
+ @enumerable.each_quad.should be_instance_of(Enumerable::Enumerator)
112
+ @enumerable.each_quad { |*quad| quad.should be_a_quad }
113
+ end
114
+
115
+ it "should support #enum_quad" do
116
+ @enumerable.respond_to?(:enum_quad).should be_true
117
+
118
+ @enumerable.enum_quad.should be_instance_of(Enumerable::Enumerator)
119
+ end
120
+ end
121
+
122
+ context "subjects" do
123
+ it "should support #subjects" do
124
+ @enumerable.respond_to?(:subjects).should be_true
125
+
126
+ @enumerable.subjects.should be_instance_of(Array)
127
+ @enumerable.subjects.each { |value| value.should be_a_resource }
128
+ end
129
+
130
+ it "should support #has_subject?" do
131
+ @enumerable.respond_to?(:has_subject?).should be_true
132
+
133
+ @statements.each do |statement|
134
+ @enumerable.has_subject?(statement.subject).should be_true
135
+ end
136
+ end
137
+
138
+ it "should support #each_subject" do
139
+ @enumerable.respond_to?(:each_subject).should be_true
140
+
141
+ @enumerable.each_subject.should be_instance_of(Enumerable::Enumerator)
142
+ @enumerable.each_subject { |value| value.should be_a_resource }
143
+ end
144
+
145
+ it "should support #enum_subject" do
146
+ @enumerable.respond_to?(:enum_subject).should be_true
147
+
148
+ @enumerable.enum_subject.should be_instance_of(Enumerable::Enumerator)
149
+ end
150
+ end
151
+
152
+ context "predicates" do
153
+ it "should support #predicates" do
154
+ @enumerable.respond_to?(:predicates).should be_true
155
+
156
+ @enumerable.predicates.should be_instance_of(Array)
157
+ @enumerable.predicates.each { |value| value.should be_a_uri }
158
+ end
159
+
160
+ it "should support #has_predicate?" do
161
+ @enumerable.respond_to?(:has_predicate?).should be_true
162
+
163
+ @statements.each do |statement|
164
+ @enumerable.has_predicate?(statement.predicate).should be_true
165
+ end
166
+ end
167
+
168
+ it "should support #each_predicate" do
169
+ @enumerable.respond_to?(:each_predicate).should be_true
170
+
171
+ @enumerable.each_predicate.should be_instance_of(Enumerable::Enumerator)
172
+ @enumerable.each_predicate { |value| value.should be_a_uri }
173
+ end
174
+
175
+ it "should support #enum_predicate" do
176
+ @enumerable.respond_to?(:enum_predicate).should be_true
177
+
178
+ @enumerable.enum_predicate.should be_instance_of(Enumerable::Enumerator)
179
+ end
180
+ end
181
+
182
+ context "objects" do
183
+ it "should support #objects" do
184
+ @enumerable.respond_to?(:objects).should be_true
185
+
186
+ @enumerable.objects.should be_instance_of(Array)
187
+ @enumerable.objects.each { |value| value.should be_a_value }
188
+ end
189
+
190
+ it "should support #has_object?" do
191
+ @enumerable.respond_to?(:has_object?).should be_true
192
+
193
+ @statements.each do |statement|
194
+ @enumerable.has_object?(statement.object).should be_true
195
+ end
196
+ end
197
+
198
+ it "should support #each_object" do
199
+ @enumerable.respond_to?(:each_object).should be_true
200
+
201
+ @enumerable.each_object.should be_instance_of(Enumerable::Enumerator)
202
+ @enumerable.each_object { |value| value.should be_a_value }
203
+ end
204
+
205
+ it "should support #enum_object" do
206
+ @enumerable.respond_to?(:enum_object).should be_true
207
+
208
+ @enumerable.enum_object.should be_instance_of(Enumerable::Enumerator)
209
+ end
210
+ end
211
+
212
+ context "contexts" do
213
+ it "should support #contexts" do
214
+ @enumerable.respond_to?(:contexts).should be_true
215
+
216
+ @enumerable.contexts.should be_instance_of(Array)
217
+ @enumerable.contexts.each { |value| value.should be_a_resource }
218
+ end
219
+
220
+ it "should support #has_context?" do
221
+ @enumerable.respond_to?(:has_context?).should be_true
222
+
223
+ @statements.each do |statement|
224
+ if statement.has_context?
225
+ @enumerable.has_context?(statement.context).should be_true
226
+ end
227
+ end
228
+ end
229
+
230
+ it "should support #each_context" do
231
+ @enumerable.respond_to?(:each_context).should be_true
232
+
233
+ @enumerable.each_context.should be_instance_of(Enumerable::Enumerator)
234
+ @enumerable.each_context { |value| value.should be_a_resource }
235
+ end
236
+
237
+ it "should support #enum_context" do
238
+ @enumerable.respond_to?(:enum_context).should be_true
239
+
240
+ @enumerable.enum_context.should be_instance_of(Enumerable::Enumerator)
241
+ end
242
+ end
243
+
244
+ it "should support #to_hash" do
245
+ @enumerable.respond_to?(:to_hash).should be_true
246
+
247
+ # TODO
248
+ end
249
+ end
@@ -0,0 +1,132 @@
1
+ require 'spec'
2
+
3
+ module RDF; module Spec
4
+ ##
5
+ # RDF matchers for RSpec.
6
+ #
7
+ # @see http://rspec.rubyforge.org/rspec/1.2.9/classes/Spec/Matchers.html
8
+ module Matchers
9
+ ##
10
+ # Defines a new RSpec matcher.
11
+ #
12
+ # @param [Symbol] name
13
+ # @return [void]
14
+ def self.define(name, &declarations)
15
+ define_method name do |*expected|
16
+ ::Spec::Matchers::Matcher.new(name, *expected, &declarations)
17
+ end
18
+ end
19
+
20
+ define :be_a_statement do
21
+ match do |statement|
22
+ statement.should be_instance_of(RDF::Statement)
23
+ statement.subject.should be_a_kind_of(RDF::Resource)
24
+ statement.predicate.should be_a_kind_of(RDF::URI)
25
+ statement.object.should be_a_kind_of(RDF::Value) unless statement.object.is_a?(String) # FIXME
26
+ true
27
+ end
28
+ end
29
+
30
+ define :be_a_triple do
31
+ match do |triple|
32
+ triple.should be_instance_of(Array)
33
+ triple.size.should == 3
34
+ triple[0].should be_a_kind_of(RDF::Resource)
35
+ triple[1].should be_a_kind_of(RDF::URI)
36
+ triple[2].should be_a_kind_of(RDF::Value) unless triple[2].is_a?(String) # FIXME
37
+ true
38
+ end
39
+ end
40
+
41
+ define :be_a_quad do
42
+ match do |quad|
43
+ quad.should be_instance_of(Array)
44
+ quad.size.should == 4
45
+ quad[0].should be_a_kind_of(RDF::Resource)
46
+ quad[1].should be_a_kind_of(RDF::URI)
47
+ quad[2].should be_a_kind_of(RDF::Value) unless quad[2].is_a?(String) # FIXME
48
+ quad[3].should be_a_kind_of(RDF::Resource) unless quad[3].nil?
49
+ true
50
+ end
51
+ end
52
+
53
+ define :be_a_resource do
54
+ match do |value|
55
+ value.should be_a_kind_of(RDF::Resource)
56
+ true
57
+ end
58
+ end
59
+
60
+ define :be_a_uri do
61
+ match do |value|
62
+ value.should be_a_kind_of(RDF::URI)
63
+ true
64
+ end
65
+ end
66
+
67
+ define :be_a_value do
68
+ match do |value|
69
+ value.should be_a_kind_of(RDF::Value) unless value.is_a?(String) # FIXME
70
+ true
71
+ end
72
+ end
73
+
74
+ define :be_a_vocabulary do |base_uri|
75
+ match do |vocabulary|
76
+ vocabulary.should be_a_kind_of(Module)
77
+ vocabulary.should respond_to(:to_uri)
78
+ vocabulary.to_uri.to_s.should == base_uri
79
+ vocabulary.should respond_to(:[])
80
+ true
81
+ end
82
+ end
83
+
84
+ define :have_properties do |base_uri, properties|
85
+ match do |vocabulary|
86
+ properties.map(&:to_sym).each do |property|
87
+ vocabulary[property].should be_a_uri
88
+ vocabulary[property].to_s.should == "#{base_uri}#{property}"
89
+ #vocabulary.should respond_to(property) # FIXME
90
+ lambda { vocabulary.send(property) }.should_not raise_error
91
+ vocabulary.send(property).should be_a_uri
92
+ vocabulary.send(property.to_s).should be_a_uri
93
+ vocabulary.send(property).to_s.should == "#{base_uri}#{property}"
94
+ end
95
+ true
96
+ end
97
+ end
98
+
99
+ define :have_subclasses do |base_uri, klasses|
100
+ match do |vocabulary|
101
+ klasses.map(&:to_sym).each do |klass|
102
+ # TODO
103
+ end
104
+ true
105
+ end
106
+ end
107
+
108
+ define :be_a_repository do
109
+ match do |repository|
110
+ repository.should be_a_kind_of(RDF::Repository)
111
+ true
112
+ end
113
+ end
114
+
115
+ define :be_a_repository_of_size do |size|
116
+ match do |repository|
117
+ repository.should be_a_repository
118
+ repository.size == size
119
+ end
120
+ end
121
+
122
+ define :have_predicate do |predicate, count|
123
+ match do |queryable|
124
+ if count.nil?
125
+ queryable.has_predicate?(predicate)
126
+ else
127
+ queryable.query([nil, predicate, nil]).size == count
128
+ end
129
+ end
130
+ end
131
+ end # module Matchers
132
+ end; end # module Spec; module RDF
@@ -0,0 +1,78 @@
1
+ require 'rdf/spec'
2
+ require 'spec'
3
+
4
+ share_as :RDF_Repository do
5
+ include RDF::Spec::Matchers
6
+
7
+ before :each do
8
+ raise '+@repository+ must be defined in a before(:each) block' unless instance_variable_get('@repository')
9
+ @filename = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'etc', 'doap.nt'))
10
+ @statements = RDF::NTriples::Reader.new(File.open(@filename)).to_a
11
+ @enumerable = @repository
12
+ end
13
+
14
+ it "should be empty initially" do
15
+ @repository.empty?.should be_true
16
+ @repository.count.should be_zero
17
+ end
18
+
19
+ it "should be readable" do
20
+ @repository.readable?.should be_true
21
+ end
22
+
23
+ it "should be mutable" do
24
+ @repository.immutable?.should be_false
25
+ @repository.mutable?.should be_true
26
+ end
27
+
28
+ context "when inserting statements" do
29
+ it "should support #insert" do
30
+ @repository.should respond_to(:insert)
31
+ end
32
+
33
+ it "should not raise errors" do
34
+ lambda { @repository.insert(@statements.first) }.should_not raise_error
35
+ end
36
+
37
+ it "should support inserting one statement at a time" do
38
+ @repository.insert(@statements.first)
39
+ end
40
+
41
+ it "should support inserting multiple statements at a time" do
42
+ @repository.insert(*@statements)
43
+ end
44
+
45
+ it "should insert statements successfully" do
46
+ @repository.insert(*@statements)
47
+ @repository.count.should == @statements.size
48
+ end
49
+ end
50
+
51
+ context "when deleting statements" do
52
+ it "should support #delete" do
53
+ @repository.should respond_to(:delete)
54
+ end
55
+
56
+ it "should not raise errors"
57
+ it "should support deleting one statement at a time"
58
+ it "should support deleting multiple statements at a time"
59
+ it "should delete statements successfully"
60
+ end
61
+
62
+ context "when enumerating statements" do
63
+ require 'rdf/spec/enumerable'
64
+
65
+ before :each do
66
+ @repository.insert(*@statements)
67
+ @enumerable = @repository
68
+ end
69
+
70
+ it_should_behave_like RDF_Enumerable
71
+ end
72
+
73
+ context "when clearing all statements" do
74
+ it "should support #clear" do
75
+ @repository.should respond_to(:clear)
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,23 @@
1
+ module RDF; module Spec
2
+ module VERSION
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 9
6
+ EXTRA = nil
7
+
8
+ STRING = [MAJOR, MINOR, TINY].join('.')
9
+ STRING << "-#{EXTRA}" if EXTRA
10
+
11
+ ##
12
+ # @return [String]
13
+ def self.to_s() STRING end
14
+
15
+ ##
16
+ # @return [String]
17
+ def self.to_str() STRING end
18
+
19
+ ##
20
+ # @return [Array(Integer, Integer, Integer)]
21
+ def self.to_a() [MAJOR, MINOR, TINY] end
22
+ end
23
+ end; end
@@ -0,0 +1,12 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require 'rdf/spec/enumerable'
3
+
4
+ describe RDF::Enumerable do
5
+ before :each do
6
+ @statements = RDF::NTriples::Reader.new(File.open("etc/doap.nt")).to_a
7
+ @enumerable = @statements.dup.extend(RDF::Enumerable)
8
+ end
9
+
10
+ # @see lib/rdf/spec/enumerable.rb
11
+ it_should_behave_like RDF_Enumerable
12
+ end
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require 'rdf/spec/repository'
3
+
4
+ describe RDF::Repository do
5
+ before :each do
6
+ @repository = RDF::Repository.new
7
+ end
8
+
9
+ # @see lib/rdf/spec/repository.rb
10
+ it_should_behave_like RDF_Repository
11
+ end
@@ -0,0 +1,6 @@
1
+ require 'rdf'
2
+ require 'rdf/spec'
3
+
4
+ Spec::Runner.configure do |config|
5
+ config.include(RDF::Spec::Matchers)
6
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdf-spec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
5
+ platform: ruby
6
+ authors:
7
+ - Arto Bendiken
8
+ - Ben Lavender
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2010-02-04 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rdf
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.9
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ type: :development
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.2.9
35
+ version:
36
+ - !ruby/object:Gem::Dependency
37
+ name: yard
38
+ type: :development
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 0.5.3
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ type: :runtime
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.9
55
+ version:
56
+ description: RDF.rb plugin that provides RSpec matchers and shared examples for RDF objects.
57
+ email: arto.bendiken@gmail.com
58
+ executables: []
59
+
60
+ extensions: []
61
+
62
+ extra_rdoc_files: []
63
+
64
+ files:
65
+ - AUTHORS
66
+ - README
67
+ - UNLICENSE
68
+ - VERSION
69
+ - etc/doap.nt
70
+ - lib/rdf/spec/enumerable.rb
71
+ - lib/rdf/spec/matchers.rb
72
+ - lib/rdf/spec/repository.rb
73
+ - lib/rdf/spec/version.rb
74
+ - lib/rdf/spec.rb
75
+ - spec/enumerable_spec.rb
76
+ - spec/repository_spec.rb
77
+ - spec/spec_helper.rb
78
+ has_rdoc: false
79
+ homepage: http://rdf.rubyforge.org/
80
+ licenses:
81
+ - Public Domain
82
+ post_install_message:
83
+ rdoc_options: []
84
+
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 1.8.2
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ requirements: []
100
+
101
+ rubyforge_project: rdf
102
+ rubygems_version: 1.3.5
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: RSpec extensions for RDF.rb.
106
+ test_files: []
107
+