rdf-spec 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- require 'spec'
1
+ require 'rspec' # @see http://rubygems.org/gems/rspec
2
2
 
3
3
  module RDF; module Spec
4
4
  ##
@@ -13,7 +13,7 @@ module RDF; module Spec
13
13
  # @return [void]
14
14
  def self.define(name, &declarations)
15
15
  define_method name do |*expected|
16
- ::Spec::Matchers::Matcher.new(name, *expected, &declarations)
16
+ ::RSpec::Matchers::Matcher.new(name, *expected, &declarations)
17
17
  end
18
18
  end
19
19
 
@@ -177,5 +177,5 @@ module RDF; module Spec
177
177
  end
178
178
  end
179
179
  end
180
- end # module Matchers
181
- end; end # module Spec; module RDF
180
+ end # Matchers
181
+ end; end # RDF::Spec
@@ -1,4 +1,3 @@
1
- require 'rdf'
2
1
  require 'rdf/spec'
3
2
  require 'rdf/ntriples'
4
3
 
data/lib/rdf/spec/node.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'rdf'
2
1
  require 'rdf/spec'
3
2
 
4
3
  share_as :RDF_Node do
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Query do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Queryable do
5
4
  include RDF::Spec::Matchers
@@ -290,9 +289,9 @@ share_as :RDF_Queryable do
290
289
  # FIXME: these tests should be using the provided @queryable, if possible.
291
290
  @queryable = RDF::Graph.new do |graph|
292
291
  @subject = RDF::Node.new
293
- graph << [subject, RDF.type, RDF::DOAP.Project]
294
- graph << [subject, RDF::DC.creator, RDF::URI.new('http://example.org/#jhacker')]
295
- graph << [subject, RDF::DC.creator, @literal = RDF::Literal.new('J. Random Hacker')]
292
+ graph << [@subject, RDF.type, RDF::DOAP.Project]
293
+ graph << [@subject, RDF::DC.creator, RDF::URI.new('http://example.org/#jhacker')]
294
+ graph << [@subject, RDF::DC.creator, @literal = RDF::Literal.new('J. Random Hacker')]
296
295
  end
297
296
  @failing_pattern = [nil, nil, RDF::Node.new]
298
297
  end
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Readable do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Reader do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Repository do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Resource do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Statement do
5
4
  include RDF::Spec::Matchers
@@ -0,0 +1,7 @@
1
+ require 'rdf/spec'
2
+
3
+ share_as :RDF_Term do
4
+ include RDF::Spec::Matchers
5
+
6
+ # TODO
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'rdf/spec'
2
+
3
+ share_as :RDF_Transaction do
4
+ include RDF::Spec::Matchers
5
+
6
+ # TODO
7
+ end
data/lib/rdf/spec/uri.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'rdf'
2
1
  require 'rdf/spec'
3
2
 
4
3
  share_as :RDF_URI do
@@ -71,4 +70,129 @@ share_as :RDF_URI do
71
70
  it "should not be #anonymous?" do
72
71
  @new.call('http://example.org').should_not be_anonymous
73
72
  end
73
+
74
+ context "using the smart separator (/)" do
75
+ {
76
+ # #!! means that I'm not sure I like the semantics, but they are cases for
77
+ # arguably invalid input, probably without 'correct' answers.
78
+
79
+ %w(http://foo a) => "http://foo/a",
80
+ %w(http://foo /a) => "http://foo/a",
81
+ %w(http://foo #a) => "http://foo#a",
82
+
83
+ %w(http://foo/ a) => "http://foo/a",
84
+ %w(http://foo/ /a) => "http://foo/a",
85
+ %w(http://foo/ #a) => "http://foo#a", #!!
86
+
87
+ %w(http://foo# a) => "http://foo#a",
88
+ %w(http://foo# /a) => "http://foo/a", #!!
89
+ %w(http://foo# #a) => "http://foo#a",
90
+
91
+ %w(http://foo/bar a) => "http://foo/bar/a",
92
+ %w(http://foo/bar /a) => "http://foo/bar/a",
93
+ %w(http://foo/bar #a) => "http://foo/bar#a",
94
+
95
+ %w(http://foo/bar/ a) => "http://foo/bar/a",
96
+ %w(http://foo/bar/ /a) => "http://foo/bar/a",
97
+ %w(http://foo/bar/ #a) => "http://foo/bar#a", #!!
98
+
99
+ %w(http://foo/bar# a) => "http://foo/bar#a",
100
+ %w(http://foo/bar# /a) => "http://foo/bar/a", #!!
101
+ %w(http://foo/bar# #a) => "http://foo/bar#a",
102
+
103
+ %w(urn:isbn: 0451450523) => "urn:isbn:0451450523",
104
+ %w(urn:isbn: :0451450523) => "urn:isbn:0451450523",
105
+
106
+ %w(urn:isbn 0451450523) => "urn:isbn:0451450523",
107
+ %w(urn:isbn :0451450523) => "urn:isbn:0451450523",
108
+ }.each_pair do |input, result|
109
+ it "should create <#{result}> from <#{input[0]}> and '#{input[1]}'" do
110
+ (RDF::URI.new(input[0]) / input[1]).to_s.should == result
111
+ (RDF::URI.new(input[0]) / RDF::URI.new(input[1])).to_s.should == result
112
+ end
113
+ end
114
+
115
+ it "should raise an ArgumentError when receiving an absolute URI as a fragment" do
116
+ lambda { RDF::URI.new('http://example.org') / RDF::URI.new('http://example.com') }.should raise_error ArgumentError
117
+ end
118
+ end
119
+
120
+ context "using concatenation (#+)" do
121
+ {
122
+ %w(http://foo/ a) => "http://foo/a",
123
+ %w(http://foo/ /a) => "http://foo//a",
124
+ %w(http://foo/ #a) => "http://foo/#a",
125
+
126
+ %w(urn:isbn :0451450523) => "urn:isbn:0451450523",
127
+ %w(urn:isbn 0451450523) => "urn:isbn0451450523",
128
+
129
+ %w(http://example.org/test test) => "http://example.org/testtest",
130
+ }.each_pair do |input, result|
131
+ it "should create <#{result}> from <#{input[0]}> and '#{input[1]}'" do
132
+ (RDF::URI.new(input[0]) + input[1]).to_s.should == result
133
+ (RDF::URI.new(input[0]) + RDF::URI.new(input[1])).to_s.should == result
134
+ end
135
+ end
136
+ end
137
+
138
+ context "using normalized merging (#join)" do
139
+
140
+ before :all do
141
+ @writer = RDF::Writer.for(:ntriples)
142
+ end
143
+
144
+ before :each do
145
+ @subject = RDF::URI.new("http://example.org")
146
+ end
147
+
148
+ it "appends fragment to uri" do
149
+ @subject.join("foo").to_s.should == "http://example.org/foo"
150
+ end
151
+
152
+ it "appends another fragment" do
153
+ @subject.join("foo#bar").to_s.should == "http://example.org/foo#bar"
154
+ end
155
+
156
+ it "appends another URI" do
157
+ @subject.join(RDF::URI.new("foo#bar")).to_s.should == "http://example.org/foo#bar"
158
+ end
159
+
160
+ {
161
+ %w(http://foo ) => "<http://foo>",
162
+ %w(http://foo a) => "<http://foo/a>",
163
+ %w(http://foo /a) => "<http://foo/a>",
164
+ %w(http://foo #a) => "<http://foo#a>",
165
+
166
+ %w(http://foo/ ) => "<http://foo/>",
167
+ %w(http://foo/ a) => "<http://foo/a>",
168
+ %w(http://foo/ /a) => "<http://foo/a>",
169
+ %w(http://foo/ #a) => "<http://foo/#a>",
170
+
171
+ %w(http://foo# ) => "<http://foo#>",
172
+ %w(http://foo# a) => "<http://foo/a>",
173
+ %w(http://foo# /a) => "<http://foo/a>",
174
+ %w(http://foo# #a) => "<http://foo#a>",
175
+
176
+ %w(http://foo/bar ) => "<http://foo/bar>",
177
+ %w(http://foo/bar a) => "<http://foo/a>",
178
+ %w(http://foo/bar /a) => "<http://foo/a>",
179
+ %w(http://foo/bar #a) => "<http://foo/bar#a>",
180
+
181
+ %w(http://foo/bar/ ) => "<http://foo/bar/>",
182
+ %w(http://foo/bar/ a) => "<http://foo/bar/a>",
183
+ %w(http://foo/bar/ /a) => "<http://foo/a>",
184
+ %w(http://foo/bar/ #a) => "<http://foo/bar/#a>",
185
+
186
+ %w(http://foo/bar# ) => "<http://foo/bar#>",
187
+ %w(http://foo/bar# a) => "<http://foo/a>",
188
+ %w(http://foo/bar# /a) => "<http://foo/a>",
189
+ %w(http://foo/bar# #a) => "<http://foo/bar#a>",
190
+
191
+ }.each_pair do |input, result|
192
+ it "creates #{result} from <#{input[0]}> and '#{input[1]}'" do
193
+ @writer.serialize(RDF::URI.new(input[0]).join(input[1].to_s)).should == result
194
+ end
195
+ end
196
+ end
197
+
74
198
  end
@@ -1,4 +1,3 @@
1
- require 'rdf'
2
1
  require 'rdf/spec'
3
2
 
4
3
  share_as :RDF_Value do
@@ -1,8 +1,8 @@
1
1
  module RDF; module Spec
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 2
5
- TINY = 3
4
+ MINOR = 3
5
+ TINY = 0
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Vocabulary do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Writable do
5
4
  include RDF::Spec::Matchers
@@ -1,5 +1,4 @@
1
1
  require 'rdf/spec'
2
- require 'spec'
3
2
 
4
3
  share_as :RDF_Writer do
5
4
  include RDF::Spec::Matchers
data/spec/spec_helper.rb CHANGED
@@ -3,4 +3,7 @@ require 'rdf/spec'
3
3
 
4
4
  Spec::Runner.configure do |config|
5
5
  config.include(RDF::Spec::Matchers)
6
+ config.exclusion_filter = {:ruby => lambda { |version|
7
+ RUBY_VERSION.to_s !~ /^#{version}/
8
+ }}
6
9
  end
metadata CHANGED
@@ -4,75 +4,75 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
7
  - 3
9
- version: 0.2.3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Arto Bendiken
13
13
  - Ben Lavender
14
+ - Gregg Kellogg
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-08-26 00:00:00 +02:00
19
+ date: 2010-12-27 00:00:00 +01:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- name: yard
23
+ name: rspec
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
28
29
  segments:
29
- - 0
30
- - 5
31
- - 8
32
- version: 0.5.8
33
- type: :development
30
+ - 2
31
+ - 1
32
+ version: "2.1"
33
+ type: :runtime
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: rspec
36
+ name: yard
37
37
  prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  segments:
43
- - 1
44
- - 3
45
43
  - 0
46
- version: 1.3.0
44
+ - 6
45
+ - 0
46
+ version: 0.6.0
47
47
  type: :development
48
48
  version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency
50
- name: rdf
50
+ name: rspec
51
51
  prerelease: false
52
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  segments:
57
- - 0
58
57
  - 2
59
- - 3
60
- version: 0.2.3
58
+ - 1
59
+ - 0
60
+ version: 2.1.0
61
61
  type: :development
62
62
  version_requirements: *id003
63
63
  - !ruby/object:Gem::Dependency
64
- name: rspec
64
+ name: rdf
65
65
  prerelease: false
66
66
  requirement: &id004 !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ~>
69
69
  - !ruby/object:Gem::Version
70
70
  segments:
71
- - 1
71
+ - 0
72
72
  - 3
73
73
  - 0
74
- version: 1.3.0
75
- type: :runtime
74
+ version: 0.3.0
75
+ type: :development
76
76
  version_requirements: *id004
77
77
  description: RDF.rb plugin that provides RSpec matchers and shared examples for RDF objects.
78
78
  email: public-rdf-ruby@w3.org
@@ -84,7 +84,7 @@ extra_rdoc_files: []
84
84
 
85
85
  files:
86
86
  - AUTHORS
87
- - CONTRIBUTORS
87
+ - CREDITS
88
88
  - README
89
89
  - UNLICENSE
90
90
  - VERSION
@@ -94,6 +94,8 @@ files:
94
94
  - lib/rdf/spec/enumerable.rb
95
95
  - lib/rdf/spec/format.rb
96
96
  - lib/rdf/spec/graph.rb
97
+ - lib/rdf/spec/indexable.rb
98
+ - lib/rdf/spec/inferable.rb
97
99
  - lib/rdf/spec/list.rb
98
100
  - lib/rdf/spec/literal.rb
99
101
  - lib/rdf/spec/matchers.rb
@@ -106,6 +108,8 @@ files:
106
108
  - lib/rdf/spec/repository.rb
107
109
  - lib/rdf/spec/resource.rb
108
110
  - lib/rdf/spec/statement.rb
111
+ - lib/rdf/spec/term.rb
112
+ - lib/rdf/spec/transaction.rb
109
113
  - lib/rdf/spec/uri.rb
110
114
  - lib/rdf/spec/value.rb
111
115
  - lib/rdf/spec/version.rb
data/CONTRIBUTORS DELETED
@@ -1,2 +0,0 @@
1
- * Gregg Kellogg <gregg@kellogg-assoc.com>
2
- * John Fieber <jrf@ursamaris.org>