dbd 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +2 -2
- data/HISTORY.txt +11 -0
- data/README.md +24 -5
- data/bin/test_4.rb +2 -2
- data/bin/test_6.rb +2 -2
- data/docs/test.rb +1 -1
- data/lib/dbd/fact.rb +35 -67
- data/lib/dbd/fact/factory.rb +90 -0
- data/lib/dbd/fact/id.rb +2 -2
- data/lib/dbd/fact/subject.rb +2 -2
- data/lib/dbd/graph.rb +4 -6
- data/lib/dbd/helpers/uuid.rb +2 -2
- data/lib/dbd/resource.rb +1 -1
- data/lib/dbd/time_stamp.rb +16 -7
- data/lib/dbd/version.rb +1 -1
- data/spec/lib/dbd/fact/collection/collection_spec.rb +59 -59
- data/spec/lib/dbd/fact/factory/factory_spec.rb +109 -0
- data/spec/lib/dbd/fact/id/id_spec.rb +4 -4
- data/spec/lib/dbd/fact/id/test_factories_spec.rb +14 -0
- data/spec/lib/dbd/fact/methods_spec.rb +53 -57
- data/spec/lib/dbd/fact/new_spec.rb +32 -55
- data/spec/lib/dbd/fact/subject/subject_spec.rb +3 -3
- data/spec/lib/dbd/fact/subject/test_factories_spec.rb +23 -0
- data/spec/lib/dbd/fact/test_factories_spec.rb +82 -0
- data/spec/lib/dbd/graph/add_to_graph_spec.rb +31 -31
- data/spec/lib/dbd/graph/from_csv_spec.rb +47 -20
- data/spec/lib/dbd/graph/test_factories_spec.rb +58 -0
- data/spec/lib/dbd/graph/to_csv_spec.rb +46 -45
- data/spec/lib/dbd/helpers/ordered_set_collection/ordered_set_collection_spec.rb +17 -17
- data/spec/lib/dbd/helpers/uuid/uuid_spec.rb +11 -5
- data/spec/lib/dbd/performance_spec.rb +6 -6
- data/spec/lib/dbd/provenance_fact/methods_spec.rb +19 -19
- data/spec/lib/dbd/provenance_fact/new_spec.rb +17 -17
- data/spec/lib/dbd/provenance_fact/test_factories_spec.rb +24 -0
- data/spec/lib/dbd/provenance_resource/provenance_resource_spec.rb +24 -24
- data/spec/lib/dbd/rdf_base/rdf_base_spec.rb +7 -7
- data/spec/lib/dbd/resource/collection_spec.rb +34 -34
- data/spec/lib/dbd/resource/new_spec.rb +12 -12
- data/spec/lib/dbd/resource/test_factories_spec.rb +25 -0
- data/spec/lib/dbd/time_stamp/comparisons_spec.rb +31 -30
- data/spec/lib/dbd/time_stamp/methods_spec.rb +17 -13
- data/spec/lib/dbd/time_stamp/new_spec.rb +40 -14
- data/spec/lib/dbd/time_stamp/test_factories_spec.rb +18 -0
- data/spec/spec_helper.rb +2 -6
- data/spec/{factories → test_factories}/fact.rb +32 -25
- data/spec/{factories → test_factories}/fact/id.rb +2 -2
- data/spec/{factories → test_factories}/fact/subject.rb +3 -3
- data/spec/test_factories/graph.rb +25 -0
- data/spec/{factories → test_factories}/provenance_fact.rb +8 -10
- data/spec/{factories → test_factories}/provenance_resource.rb +3 -3
- data/spec/{factories → test_factories}/resource.rb +10 -4
- data/spec/{factories → test_factories}/time_stamp.rb +2 -2
- metadata +35 -32
- data/spec/factories/graph.rb +0 -23
- data/spec/lib/dbd/fact/factory_spec.rb +0 -82
- data/spec/lib/dbd/fact/id/factory_spec.rb +0 -16
- data/spec/lib/dbd/fact/subject/factory_spec.rb +0 -25
- data/spec/lib/dbd/graph/factory_spec.rb +0 -33
- data/spec/lib/dbd/provenance_fact/factory_spec.rb +0 -24
- data/spec/lib/dbd/resource/factory_spec.rb +0 -18
- data/spec/lib/dbd/time_stamp/factory_spec.rb +0 -18
data/lib/dbd/graph.rb
CHANGED
@@ -52,13 +52,11 @@ module Dbd
|
|
52
52
|
#
|
53
53
|
# @param [IO Stream] csv an IO Stream that contains the CSV serialization
|
54
54
|
# @return [Graph] the imported graph
|
55
|
-
def
|
56
|
-
new.
|
57
|
-
|
58
|
-
# TODO validate the input formats (e.g. invalid uuid codes)
|
59
|
-
graph << Fact.from_string_values(row)
|
60
|
-
end
|
55
|
+
def from_CSV(csv)
|
56
|
+
CSV.new(csv).each do |row|
|
57
|
+
self << Fact.factory.from_string_values(row, validate: true)
|
61
58
|
end
|
59
|
+
self
|
62
60
|
end
|
63
61
|
|
64
62
|
private
|
data/lib/dbd/helpers/uuid.rb
CHANGED
@@ -10,8 +10,8 @@ module Dbd
|
|
10
10
|
##
|
11
11
|
# A regexp that can be used in tests.
|
12
12
|
# @return [Regexp]
|
13
|
-
def self.
|
14
|
-
|
13
|
+
def self.valid_regexp
|
14
|
+
/\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\Z/
|
15
15
|
end
|
16
16
|
|
17
17
|
##
|
data/lib/dbd/resource.rb
CHANGED
data/lib/dbd/time_stamp.rb
CHANGED
@@ -53,8 +53,8 @@ module Dbd
|
|
53
53
|
# regexp for the nanosecond granularity and in UTC
|
54
54
|
#
|
55
55
|
# Can be used to validate input strings or in tests.
|
56
|
-
def self.
|
57
|
-
/\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{9} UTC/
|
56
|
+
def self.valid_regexp
|
57
|
+
/\A\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{9} UTC\Z/
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
@@ -63,15 +63,24 @@ module Dbd
|
|
63
63
|
[Time.now.utc, (larger_than && larger_than.time)].compact.max + random_offset
|
64
64
|
end
|
65
65
|
|
66
|
+
# Minimum offset between consecutive times.
|
67
|
+
# For jruby, a 1 ns offset was not enough
|
68
|
+
# (some collisions, see https://github.com/jruby/jruby/issues/843)
|
69
|
+
# With 2 ns, the problem disappears (probably a "1 off" rounding error
|
70
|
+
# that cannot occur with a minimum distance of 2?).
|
71
|
+
def minimum_time_offset
|
72
|
+
Rational('2/1_000_000_000')
|
73
|
+
end
|
74
|
+
|
75
|
+
# Random offset, between minimum_time_offset and 1 us (1 micro second)
|
66
76
|
def random_offset
|
67
|
-
Rational("#{
|
77
|
+
minimum_time_offset + Rational("#{rand(990)}/1_000_000_000")
|
68
78
|
end
|
69
79
|
|
70
80
|
def time_format
|
71
81
|
'%F %T.%N %Z'
|
72
82
|
end
|
73
83
|
|
74
|
-
##
|
75
84
|
# with a nanosecond granularity and in UTC
|
76
85
|
def time_from_s(time_string)
|
77
86
|
# For ns precision in JRuby this extended process is required
|
@@ -83,7 +92,7 @@ module Dbd
|
|
83
92
|
time_hash[:hour],
|
84
93
|
time_hash[:min],
|
85
94
|
time_hash[:sec],
|
86
|
-
time_hash[:sec_fraction] * 1_000_000)
|
95
|
+
time_hash[:sec_fraction] * 1_000_000 + Rational('3/10_000_000_000'))
|
87
96
|
end
|
88
97
|
|
89
98
|
def validate_time_zone(time_hash)
|
@@ -100,8 +109,8 @@ module Dbd
|
|
100
109
|
@time.strftime(time_format)
|
101
110
|
end
|
102
111
|
|
103
|
-
# Max drift in time_stamp
|
104
|
-
MAX_DRIFT = Rational("1/1_000_000")
|
112
|
+
# Max drift in time_stamp for near?
|
113
|
+
MAX_DRIFT = Rational("1/1_000_000").freeze
|
105
114
|
|
106
115
|
##
|
107
116
|
# determines if 2 time_stamps are "near".
|
data/lib/dbd/version.rb
CHANGED
@@ -4,19 +4,19 @@ module Dbd
|
|
4
4
|
class Fact
|
5
5
|
describe Collection do
|
6
6
|
|
7
|
-
let(:provenance_subject_1) {
|
8
|
-
let(:provenance_subject_2) {
|
7
|
+
let(:provenance_subject_1) { Fact.factory.new_subject }
|
8
|
+
let(:provenance_subject_2) { Fact.factory.new_subject }
|
9
9
|
|
10
|
-
let(:provenance_fact_context) {
|
11
|
-
let(:provenance_fact_created_by) {
|
12
|
-
let(:provenance_fact_original_source) {
|
10
|
+
let(:provenance_fact_context) { TestFactories::ProvenanceFact.context(provenance_subject_1) }
|
11
|
+
let(:provenance_fact_created_by) { TestFactories::ProvenanceFact.created_by(provenance_subject_1) }
|
12
|
+
let(:provenance_fact_original_source) { TestFactories::ProvenanceFact.original_source(provenance_subject_2) }
|
13
13
|
|
14
|
-
let(:fact_1) {
|
15
|
-
let(:fact_2_with_subject) {
|
16
|
-
let(:fact_3_with_subject) {
|
14
|
+
let(:fact_1) { TestFactories::Fact.fact_1(provenance_subject_1) }
|
15
|
+
let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(provenance_subject_1) }
|
16
|
+
let(:fact_3_with_subject) { TestFactories::Fact.fact_3_with_subject(provenance_subject_1) }
|
17
17
|
|
18
|
-
let(:fact_2_3) {
|
19
|
-
let(:provenance_facts) {
|
18
|
+
let(:fact_2_3) { TestFactories::Fact::Collection.fact_2_3(provenance_subject_1) }
|
19
|
+
let(:provenance_facts) { TestFactories::Fact::Collection.provenance_facts(provenance_subject_1) }
|
20
20
|
|
21
21
|
let(:subject) do
|
22
22
|
Object.new.tap do |object_with_Fact_Collection|
|
@@ -25,52 +25,52 @@ module Dbd
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
describe
|
29
|
-
it
|
28
|
+
describe '.new : ' do
|
29
|
+
it 'the collection is not an array' do
|
30
30
|
subject.should_not be_a(Array)
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it 'the collection has Enumerable methods' do
|
34
34
|
subject.map #should_not raise_exception
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe
|
38
|
+
describe '.methods : ' do
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe '#<< : ' do
|
41
|
+
it 'adding a fact works' do
|
42
42
|
subject << fact_2_with_subject
|
43
43
|
subject.size.should == 1
|
44
44
|
end
|
45
45
|
|
46
|
-
it
|
46
|
+
it 'adding a provenance_fact works' do
|
47
47
|
subject << provenance_fact_context
|
48
48
|
subject.size.should == 1
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
51
|
+
it 'returns self to allow chaining' do
|
52
52
|
(subject << provenance_fact_context).should == subject
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
it
|
56
|
+
it '#first should be a Fact' do
|
57
57
|
subject << fact_2_with_subject
|
58
58
|
subject.first.should be_a(Fact)
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
61
|
+
it 'other functions (e.g. []) do not work' do
|
62
62
|
subject << fact_2_with_subject
|
63
63
|
lambda { subject[0] } . should raise_exception NoMethodError
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
66
|
+
it '#<< returns self, so chaining is possible' do
|
67
67
|
(subject << fact_2_with_subject).should == subject
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
describe
|
71
|
+
describe 'adding a fact with a ref to a provenance_fact' do
|
72
72
|
|
73
|
-
it
|
73
|
+
it 'fact_2_with_subject has a provenance_subject that refers to context and created_by' do
|
74
74
|
subject << provenance_fact_context
|
75
75
|
subject << provenance_fact_created_by
|
76
76
|
subject << fact_2_with_subject
|
@@ -79,65 +79,65 @@ module Dbd
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
83
|
-
it
|
82
|
+
describe 'newest_time_stamp' do
|
83
|
+
it 'returns nil for empty collection' do
|
84
84
|
subject.newest_time_stamp.should be_nil
|
85
85
|
end
|
86
86
|
|
87
|
-
it
|
87
|
+
it 'returns a time_stamp' do
|
88
88
|
subject << fact_2_with_subject
|
89
89
|
subject.newest_time_stamp.should be_a(fact_2_with_subject.time_stamp.class)
|
90
90
|
end
|
91
91
|
|
92
|
-
it
|
92
|
+
it 'returns the newest time_stamp' do
|
93
93
|
subject << fact_2_with_subject
|
94
94
|
subject << fact_3_with_subject
|
95
95
|
subject.newest_time_stamp.should == fact_3_with_subject.time_stamp
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
describe
|
99
|
+
describe 'validate that only "newer" elements are added' do
|
100
100
|
before(:each) do
|
101
101
|
fact_2_with_subject.stub(:time_stamp).and_return(TimeStamp.new(time: Time.utc(2013,05,9,12,0,0)))
|
102
102
|
fact_3_with_subject.stub(:time_stamp).and_return(TimeStamp.new(time: Time.utc(2013,05,9,12,0,1)))
|
103
103
|
end
|
104
104
|
|
105
|
-
it
|
105
|
+
it 'adding an element with a newer time_stamp succeeds' do
|
106
106
|
subject << fact_2_with_subject
|
107
107
|
subject << fact_3_with_subject
|
108
108
|
end
|
109
109
|
|
110
|
-
it
|
110
|
+
it 'adding an element with an older time_stamp fails' do
|
111
111
|
fact_2_with_subject # will be older then fact_3_with_subject
|
112
112
|
subject << fact_3_with_subject
|
113
113
|
lambda { subject << fact_2_with_subject } . should raise_error OutOfOrderError
|
114
114
|
end
|
115
115
|
|
116
|
-
it
|
116
|
+
it 'adding an element with an equal time_stamp fails' do
|
117
117
|
subject << fact_2_with_subject
|
118
118
|
lambda { subject << fact_2_with_subject } . should raise_error OutOfOrderError
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
describe
|
123
|
-
it
|
122
|
+
describe 'oldest_time_stamp' do
|
123
|
+
it 'returns nil for empty collection' do
|
124
124
|
subject.oldest_time_stamp.should be_nil
|
125
125
|
end
|
126
126
|
|
127
|
-
it
|
127
|
+
it 'returns a time_stamp' do
|
128
128
|
subject << fact_2_with_subject
|
129
129
|
subject.oldest_time_stamp.should be_a(fact_2_with_subject.time_stamp.class)
|
130
130
|
end
|
131
131
|
|
132
|
-
it
|
132
|
+
it 'returns the oldest time_stamp' do
|
133
133
|
subject << fact_2_with_subject
|
134
134
|
subject << fact_3_with_subject
|
135
135
|
subject.oldest_time_stamp.should == fact_2_with_subject.time_stamp
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
describe
|
140
|
-
it
|
139
|
+
describe 'provenance_facts must all come before first use by a fact' do
|
140
|
+
it 'adding a provenance_fact, depending fact, another provenance_fact with same subject fail' do
|
141
141
|
subject << provenance_fact_context
|
142
142
|
subject << fact_2_with_subject
|
143
143
|
lambda { subject << provenance_fact_created_by } . should raise_error OutOfOrderError
|
@@ -147,23 +147,23 @@ module Dbd
|
|
147
147
|
# A hash with all the provenance_subjects that are used by at least one fact.
|
148
148
|
# Needed for the validation that no provenance_fact may be added that is
|
149
149
|
# referred from a fact that is already in the fact stream.
|
150
|
-
describe
|
150
|
+
describe 'used_provenance_subjects' do
|
151
151
|
# testing an internal variable ...
|
152
152
|
|
153
153
|
let(:used_provenance_subjects) do
|
154
154
|
subject.instance_variable_get(:@used_provenance_subjects)
|
155
155
|
end
|
156
156
|
|
157
|
-
it
|
157
|
+
it 'is empty initially' do
|
158
158
|
used_provenance_subjects.should be_empty
|
159
159
|
end
|
160
160
|
|
161
|
-
it
|
161
|
+
it 'adding a provenance_fact alone does not create an entry' do
|
162
162
|
subject << provenance_fact_context
|
163
163
|
used_provenance_subjects.should be_empty
|
164
164
|
end
|
165
165
|
|
166
|
-
it
|
166
|
+
it 'adding a provenance_fact and a depending fact create an entry' do
|
167
167
|
subject << provenance_fact_context
|
168
168
|
subject << fact_2_with_subject
|
169
169
|
used_provenance_subjects[provenance_subject_1].should == true
|
@@ -171,21 +171,21 @@ module Dbd
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
describe
|
175
|
-
it
|
174
|
+
describe 'validate that facts do not have errors when loading in the Fact::Collection' do
|
175
|
+
it 'succeeds with a fact from factory' do
|
176
176
|
subject << fact_2_with_subject # should_not raise_error
|
177
177
|
end
|
178
178
|
|
179
|
-
it
|
180
|
-
provenance_fact_context.stub(:errors).and_return([
|
179
|
+
it 'raises FactError with message when fact.errors has errors' do
|
180
|
+
provenance_fact_context.stub(:errors).and_return(['Error 1', 'Error 2'])
|
181
181
|
lambda { subject << provenance_fact_context } . should raise_error(
|
182
182
|
FactError,
|
183
|
-
|
183
|
+
'Error 1, Error 2.')
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
-
describe
|
188
|
-
it
|
187
|
+
describe 'by_subject : ' do
|
188
|
+
it 'finds entries for a given subject' do
|
189
189
|
subject << provenance_fact_context
|
190
190
|
subject << provenance_fact_created_by
|
191
191
|
subject << provenance_fact_original_source
|
@@ -198,35 +198,35 @@ module Dbd
|
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
|
-
describe
|
202
|
-
describe
|
203
|
-
it
|
201
|
+
describe 'TestFactories::Fact::Collection' do
|
202
|
+
describe '.fact_2_3' do
|
203
|
+
it 'has the given provenance_subject with explicit subject arg' do
|
204
204
|
fact_2_3.each do |fact|
|
205
205
|
fact.provenance_subject.should == provenance_subject_1
|
206
206
|
end
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
-
describe
|
211
|
-
it
|
210
|
+
describe '.provenance_facts' do
|
211
|
+
it 'has a context' do
|
212
212
|
provenance_facts.select do |provenance_fact|
|
213
|
-
provenance_fact.predicate ==
|
213
|
+
provenance_fact.predicate == 'https://data.vandenabeele.com/ontologies/provenance#context'
|
214
214
|
end.size.should == 1
|
215
215
|
end
|
216
216
|
|
217
|
-
it
|
217
|
+
it 'has a created_by' do
|
218
218
|
provenance_facts.select do |provenance_fact|
|
219
|
-
provenance_fact.predicate ==
|
219
|
+
provenance_fact.predicate == 'https://data.vandenabeele.com/ontologies/provenance#created_by'
|
220
220
|
end.size.should == 1
|
221
221
|
end
|
222
222
|
|
223
|
-
it
|
223
|
+
it 'has an original_source' do
|
224
224
|
provenance_facts.select do |provenance_fact|
|
225
|
-
provenance_fact.predicate ==
|
225
|
+
provenance_fact.predicate == 'https://data.vandenabeele.com/ontologies/provenance#original_source'
|
226
226
|
end.size.should == 1
|
227
227
|
end
|
228
228
|
|
229
|
-
it
|
229
|
+
it 'has the given subjects with explicit subject arg' do
|
230
230
|
provenance_facts.each do |provenance_fact|
|
231
231
|
provenance_fact.subject.should == provenance_subject_1
|
232
232
|
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dbd
|
4
|
+
class Fact
|
5
|
+
describe Factory do
|
6
|
+
|
7
|
+
let(:top_class) { described_class.top_class }
|
8
|
+
let(:string_values) { TestFactories::Fact.string_values }
|
9
|
+
let(:id_valid_regexp) { top_class::ID.valid_regexp }
|
10
|
+
let(:subject_valid_regexp) { top_class::Subject.valid_regexp }
|
11
|
+
|
12
|
+
describe '.new_subject' do
|
13
|
+
it 'creates a new (random) subject' do
|
14
|
+
described_class.new_subject.should match(subject_valid_regexp)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'creating a second one is different' do
|
18
|
+
subject_1 = described_class.new_subject
|
19
|
+
subject_2 = described_class.new_subject
|
20
|
+
subject_1.should_not == subject_2
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.new_id' do
|
25
|
+
it 'creates a new (random) id' do
|
26
|
+
described_class.new_id.should match(id_valid_regexp)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'creating a second one is different' do
|
30
|
+
id_1 = described_class.new_id
|
31
|
+
id_2 = described_class.new_id
|
32
|
+
id_1.should_not == id_2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '.from_string_values' do
|
37
|
+
it 'reads the values correctly (round trip test)' do
|
38
|
+
fact = described_class.from_string_values(string_values)
|
39
|
+
fact.string_values.should == string_values
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'calls validate_string_hash if options[:validate]' do
|
43
|
+
described_class.should_receive(:validate_string_hash)
|
44
|
+
described_class.from_string_values(string_values, validate: true)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'does not call validate_string_hash if not options[:validate]' do
|
48
|
+
described_class.should_not_receive(:validate_string_hash)
|
49
|
+
described_class.from_string_values(string_values)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'validation of the string_hash' do
|
54
|
+
|
55
|
+
def with_validation(string_values)
|
56
|
+
described_class.from_string_values(string_values, :validate => true)
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'does not raise exception' do
|
60
|
+
it 'for unmodified string_values' do
|
61
|
+
with_validation(string_values)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'for a nil provenance_subject (for provenance_facts)' do
|
65
|
+
string_values[2] = nil
|
66
|
+
with_validation(string_values)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'for an empty provenance_subject (for provenance_facts)' do
|
70
|
+
string_values[2] = ''
|
71
|
+
with_validation(string_values)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'does raise exception' do
|
76
|
+
it 'for invalid id' do
|
77
|
+
string_values[0] = 'foo'
|
78
|
+
lambda{ with_validation(string_values) }.should raise_error(FactError)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'for invalid time_stamp' do
|
82
|
+
string_values[1] = 'foo'
|
83
|
+
lambda{ with_validation(string_values) }.should raise_error(FactError)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'for invalid provenance_subject' do
|
87
|
+
string_values[2] = 'foo'
|
88
|
+
lambda{ with_validation(string_values) }.should raise_error(FactError)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'for invalid subject' do
|
92
|
+
string_values[3] = 'foo'
|
93
|
+
lambda{ with_validation(string_values) }.should raise_error(FactError)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'for invalid predicate' do
|
97
|
+
string_values[4] = ''
|
98
|
+
lambda{ with_validation(string_values) }.should raise_error(FactError)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'for invalid object' do
|
102
|
+
string_values[5] = ''
|
103
|
+
lambda{ with_validation(string_values) }.should raise_error(FactError)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|