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
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
class Fact
|
5
5
|
describe ID do
|
6
|
-
it
|
7
|
-
described_class.
|
6
|
+
it '.valid_regexp has a regexp for the to_s' do
|
7
|
+
described_class.valid_regexp.should == Helpers::UUID.valid_regexp
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
11
|
-
described_class.new_id.should match(described_class.
|
10
|
+
it '.new_id' do
|
11
|
+
described_class.new_id.should match(described_class.valid_regexp)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TestFactories
|
4
|
+
module Fact
|
5
|
+
describe ID do
|
6
|
+
|
7
|
+
let(:fixed_id) { described_class.fixed_id }
|
8
|
+
|
9
|
+
it 'fixed_id is exactly this fixed id' do
|
10
|
+
fixed_id.should == '825e44d5-af33-4858-8047-549bd813daa8'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -3,34 +3,41 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
describe Fact do
|
5
5
|
|
6
|
-
let(:
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
let(:
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
let(:factory) { described_class.factory }
|
7
|
+
let(:provenance_subject) { factory.new_subject }
|
8
|
+
let(:subject) { factory.new_subject }
|
9
|
+
let(:fact_1) { TestFactories::Fact.fact_1(provenance_subject) }
|
10
|
+
let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(provenance_subject) }
|
11
|
+
let(:fact_with_newline) { TestFactories::Fact.fact_with_newline(provenance_subject) }
|
12
|
+
let(:full_fact) { TestFactories::Fact.full_fact }
|
13
|
+
|
14
|
+
describe '.factory' do
|
15
|
+
it 'should return the factory for a Fact' do
|
16
|
+
factory.should == described_class::Factory
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'time_stamp=' do
|
21
|
+
it 'checks the type (too easy to try to give a Time arg)' do
|
15
22
|
lambda{ fact_1.time_stamp = Time.now }.should raise_error(ArgumentError)
|
16
23
|
end
|
17
24
|
|
18
|
-
describe
|
25
|
+
describe 'set_once' do
|
19
26
|
|
20
27
|
let(:time_stamp_now) { TimeStamp.new }
|
21
28
|
|
22
|
-
it
|
29
|
+
it 'can be set when nil' do
|
23
30
|
fact_1.time_stamp = time_stamp_now
|
24
31
|
fact_1.time_stamp.should == time_stamp_now
|
25
32
|
end
|
26
33
|
|
27
|
-
describe
|
28
|
-
it
|
34
|
+
describe 'setting it two times' do
|
35
|
+
it 'with the value succeeds' do
|
29
36
|
fact_1.time_stamp = time_stamp_now
|
30
37
|
fact_1.time_stamp = time_stamp_now
|
31
38
|
end
|
32
39
|
|
33
|
-
it
|
40
|
+
it 'with a different value raises a SetOnceError' do
|
34
41
|
fact_1.time_stamp = time_stamp_now
|
35
42
|
lambda{ fact_1.time_stamp = (time_stamp_now+1) }.should raise_error(RubyPeterV::SetOnceError)
|
36
43
|
end
|
@@ -38,123 +45,112 @@ module Dbd
|
|
38
45
|
end
|
39
46
|
end
|
40
47
|
|
41
|
-
describe
|
42
|
-
it
|
48
|
+
describe 'short' do
|
49
|
+
it 'for a base fact shows provenance, subject, predicate, object' do
|
43
50
|
fact_1.subject = subject
|
44
51
|
fact_1.time_stamp = TimeStamp.new
|
45
52
|
fact_1.short.should match(/^[0-9a-f]{8} : [0-9a-f]{8} : http:\/\/example\.org\/test\/ : Gandhi$/)
|
46
53
|
end
|
47
54
|
|
48
|
-
it
|
55
|
+
it 'for a fact with a newline replaces it with a underscore' do
|
49
56
|
fact_with_newline.subject = subject
|
50
57
|
fact_with_newline.short.should match(/^[0-9a-f]{8} : [0-9a-f]{8} : http:\/\/example\.org\/test\/ : A long story_really.$/)
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
54
|
-
describe
|
55
|
-
it
|
61
|
+
describe 'errors' do
|
62
|
+
it 'the factory has no errors' do
|
56
63
|
fact_2_with_subject.errors.should be_empty
|
57
64
|
end
|
58
65
|
|
59
|
-
describe
|
66
|
+
describe 'without provenance_subject' do
|
60
67
|
|
61
68
|
before(:each) do
|
62
69
|
fact_2_with_subject.stub(:provenance_subject).and_return(nil)
|
63
70
|
end
|
64
71
|
|
65
|
-
it
|
72
|
+
it 'errors returns an array with 1 error message' do
|
66
73
|
fact_2_with_subject.errors.single.should match(/Provenance subject is missing/)
|
67
74
|
end
|
68
75
|
end
|
69
76
|
|
70
|
-
describe
|
77
|
+
describe 'without subject' do
|
71
78
|
|
72
79
|
before(:each) do
|
73
80
|
fact_2_with_subject.stub(:subject).and_return(nil)
|
74
81
|
end
|
75
82
|
|
76
|
-
it
|
83
|
+
it 'errors returns an array with an errorm message' do
|
77
84
|
fact_2_with_subject.errors.single.should match(/Subject is missing/)
|
78
85
|
end
|
79
86
|
end
|
80
87
|
end
|
81
88
|
|
82
|
-
describe
|
83
|
-
it
|
89
|
+
describe 'attributes' do
|
90
|
+
it 'there are 6 attributes' do
|
84
91
|
described_class.attributes.size.should == 6
|
85
92
|
end
|
86
93
|
|
87
|
-
it
|
94
|
+
it 'first attribute is :id' do
|
88
95
|
described_class.attributes.first.should == :id
|
89
96
|
end
|
90
97
|
end
|
91
98
|
|
92
|
-
describe
|
93
|
-
it
|
99
|
+
describe 'values' do
|
100
|
+
it 'there are 6 values' do
|
94
101
|
full_fact.values.size.should == 6
|
95
102
|
end
|
96
103
|
|
97
|
-
it
|
104
|
+
it 'the second element (time_stamp) is a TimeStamp' do
|
98
105
|
full_fact.values[1].should be_a(TimeStamp)
|
99
106
|
end
|
100
107
|
end
|
101
108
|
|
102
|
-
describe
|
103
|
-
it
|
109
|
+
describe 'string_values' do
|
110
|
+
it 'there are 6 string_values' do
|
104
111
|
full_fact.string_values.size.should == 6
|
105
112
|
end
|
106
113
|
|
107
|
-
it
|
114
|
+
it 'the second element (time_stamp) is a String' do
|
108
115
|
full_fact.string_values[1].should be_a(String)
|
109
116
|
end
|
110
117
|
end
|
111
118
|
|
112
|
-
describe
|
113
|
-
it
|
119
|
+
describe 'provenance_fact?' do
|
120
|
+
it 'is false for a base fact or derived from it that is not a ProvenanceFact ' do
|
114
121
|
fact_1.provenance_fact?.should be_false
|
115
122
|
end
|
116
123
|
end
|
117
124
|
|
118
|
-
|
119
|
-
["825e44d5-af33-4858-8047-549bd813daa8",
|
120
|
-
"2013-06-17 21:55:09.967653013 UTC",
|
121
|
-
"40fab407-9b04-4a51-9a52-d978abfcbb1f",
|
122
|
-
"2e9fbc87-2e94-47e9-a8fd-121cc4bc3e8f",
|
123
|
-
"http://example.org/test/name",
|
124
|
-
"Gandhi"]
|
125
|
-
end
|
125
|
+
describe 'equivalent?' do
|
126
126
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
fact.string_values.should == string_values
|
127
|
+
# no let, since we want a fresh copy on each invocation
|
128
|
+
def string_values
|
129
|
+
TestFactories::Fact.string_values
|
131
130
|
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe "equivalent?" do
|
135
131
|
|
136
|
-
let(:ref) {
|
132
|
+
let(:ref) { factory.from_string_values(string_values) }
|
137
133
|
|
138
|
-
it
|
139
|
-
other =
|
134
|
+
it 'is true for facts with same values' do
|
135
|
+
other = factory.from_string_values(string_values)
|
140
136
|
other.should be_equivalent(ref)
|
141
137
|
end
|
142
138
|
|
143
|
-
it
|
139
|
+
it 'is false for each of the entries largely different' do
|
144
140
|
(0...string_values.size).each do |index|
|
145
141
|
string_values_1_modified = string_values.dup.tap { |_string_values|
|
146
142
|
_string_values[index][3] = '4' # different and valid for all cases
|
147
143
|
}
|
148
|
-
other =
|
144
|
+
other = factory.from_string_values(string_values_1_modified)
|
149
145
|
other.should_not be_equivalent(ref)
|
150
146
|
end
|
151
147
|
end
|
152
148
|
|
153
|
-
it
|
149
|
+
it 'is true when the time_stamp is 500 ns larger' do
|
154
150
|
string_values_time_modified = string_values.dup.tap { |_string_values|
|
155
|
-
_string_values[1] =
|
151
|
+
_string_values[1] = '2013-06-17 21:55:09.967653513 UTC'
|
156
152
|
}
|
157
|
-
other =
|
153
|
+
other = factory.from_string_values(string_values_time_modified)
|
158
154
|
other.should be_equivalent(ref)
|
159
155
|
end
|
160
156
|
end
|
@@ -2,74 +2,51 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Dbd
|
4
4
|
describe Fact do
|
5
|
-
let(:
|
6
|
-
let(:
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
let(:
|
12
|
-
let(:
|
13
|
-
let(:
|
14
|
-
let(:
|
5
|
+
let(:factory) { described_class.factory}
|
6
|
+
let(:provenance_subject) { factory.new_subject }
|
7
|
+
let(:subject) { factory.new_subject }
|
8
|
+
let(:fact_1) { TestFactories::Fact.fact_1(provenance_subject) }
|
9
|
+
let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(provenance_subject) }
|
10
|
+
let(:data_predicate) { 'http://example.org/test/name' }
|
11
|
+
let(:string_object_1) { 'Gandhi' }
|
12
|
+
let(:id_valid_regexp) { described_class::ID.valid_regexp }
|
13
|
+
let(:subject_valid_regexp) { described_class::Subject.valid_regexp }
|
14
|
+
let(:forced_id) { described_class.factory.new_id }
|
15
|
+
let(:fact_with_forced_id) { TestFactories::Fact.fact_with_forced_id(forced_id) }
|
15
16
|
let(:time_stamp) { TimeStamp.new }
|
16
|
-
let(:fact_with_time_stamp) {
|
17
|
-
let(:fact_with_incorrect_time_stamp) {
|
17
|
+
let(:fact_with_time_stamp) { TestFactories::Fact.fact_with_time_stamp(time_stamp) }
|
18
|
+
let(:fact_with_incorrect_time_stamp) { TestFactories::Fact.fact_with_time_stamp(time_stamp.time) }
|
18
19
|
|
19
|
-
describe
|
20
|
-
it
|
21
|
-
|
20
|
+
describe 'create a fact' do
|
21
|
+
it 'has a unique id (matches id_valid_regexp)' do
|
22
|
+
fact_1.id.should match(id_valid_regexp)
|
22
23
|
end
|
23
24
|
|
24
|
-
it
|
25
|
-
subject_1 = described_class.new_subject
|
26
|
-
subject_2 = described_class.new_subject
|
27
|
-
subject_1.should_not == subject_2
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe ".new_id" do
|
32
|
-
it "creates a new (random) id" do
|
33
|
-
described_class.new_id.should match(id_regexp)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "creating a second one is different" do
|
37
|
-
id_1 = described_class.new_id
|
38
|
-
id_2 = described_class.new_id
|
39
|
-
id_1.should_not == id_2
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "create a fact" do
|
44
|
-
it "has a unique id (matches id_regexp)" do
|
45
|
-
fact_1.id.should match(id_regexp)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "two facts have different id" do
|
25
|
+
it 'two facts have different id' do
|
49
26
|
fact_1.id.should_not == fact_2_with_subject.id
|
50
27
|
end
|
51
28
|
|
52
|
-
it
|
29
|
+
it 'optionally sets the id' do
|
53
30
|
fact_with_forced_id.id.should == forced_id
|
54
31
|
end
|
55
32
|
|
56
|
-
it
|
33
|
+
it 'optionally sets the time_stamp' do
|
57
34
|
fact_with_time_stamp.time_stamp.should == time_stamp
|
58
35
|
end
|
59
36
|
|
60
|
-
it
|
61
|
-
lambda{ fact_with_incorrect_time_stamp }.should raise_error
|
37
|
+
it 'setting the time_stamp to a non TimeStamp raises ArgumentError' do
|
38
|
+
lambda{ fact_with_incorrect_time_stamp }.should raise_error(ArgumentError)
|
62
39
|
end
|
63
40
|
|
64
|
-
it
|
41
|
+
it 'new sets the provenance_subject' do
|
65
42
|
fact_1.provenance_subject.should == provenance_subject
|
66
43
|
end
|
67
44
|
|
68
|
-
it
|
69
|
-
fact_2_with_subject.subject.should match(
|
45
|
+
it 'new sets the subject' do
|
46
|
+
fact_2_with_subject.subject.should match(subject_valid_regexp)
|
70
47
|
end
|
71
48
|
|
72
|
-
it
|
49
|
+
it 'a nil predicate raises PredicateError' do
|
73
50
|
lambda do
|
74
51
|
described_class.new(
|
75
52
|
predicate: nil,
|
@@ -77,7 +54,7 @@ module Dbd
|
|
77
54
|
end.should raise_error(PredicateError)
|
78
55
|
end
|
79
56
|
|
80
|
-
it
|
57
|
+
it 'a nil object raises ObjectError' do
|
81
58
|
lambda do
|
82
59
|
described_class.new(
|
83
60
|
predicate: data_predicate,
|
@@ -86,20 +63,20 @@ module Dbd
|
|
86
63
|
end
|
87
64
|
end
|
88
65
|
|
89
|
-
describe
|
90
|
-
describe
|
91
|
-
it
|
66
|
+
describe 'create fact_1' do
|
67
|
+
describe 'with a string object type' do
|
68
|
+
it 'new sets the predicate' do
|
92
69
|
fact_1.predicate.should == data_predicate
|
93
70
|
end
|
94
71
|
|
95
|
-
it
|
72
|
+
it 'new sets the object' do
|
96
73
|
fact_1.object.should == string_object_1
|
97
74
|
end
|
98
75
|
end
|
99
76
|
end
|
100
77
|
|
101
|
-
describe
|
102
|
-
it
|
78
|
+
describe 'update_used_provenance_subjects' do
|
79
|
+
it 'sets the value for provenance_subject to true for a fact' do
|
103
80
|
h = {}
|
104
81
|
fact_1.update_used_provenance_subjects(h)
|
105
82
|
h[fact_1.provenance_subject].should == true
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
class Fact
|
5
5
|
describe Subject do
|
6
|
-
it ".
|
7
|
-
described_class.
|
6
|
+
it ".valid_regexp has a regexp for the to_s" do
|
7
|
+
described_class.valid_regexp.should == Helpers::UUID.valid_regexp
|
8
8
|
end
|
9
9
|
|
10
10
|
it ".new_subject" do
|
11
|
-
described_class.new_subject.should match(described_class.
|
11
|
+
described_class.new_subject.should match(described_class.valid_regexp)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TestFactories
|
4
|
+
module Fact
|
5
|
+
describe Subject do
|
6
|
+
|
7
|
+
let(:fixed_subject) { described_class.fixed_subject }
|
8
|
+
let(:fixed_provenance_subject) { described_class.fixed_provenance_subject }
|
9
|
+
|
10
|
+
describe 'fixed_subject' do
|
11
|
+
it 'fixed_subject is exactly this fixed subject' do
|
12
|
+
fixed_subject.should == '2e9fbc87-2e94-47e9-a8fd-121cc4bc3e8f'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'fixed_provenance_subject' do
|
17
|
+
it 'fixed_provenance_subject is exactly this fixed subject' do
|
18
|
+
fixed_provenance_subject.should == '40fab407-9b04-4a51-9a52-d978abfcbb1f'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TestFactories
|
4
|
+
describe Fact do
|
5
|
+
let(:provenance_subject) { ProvenanceFact.new_subject }
|
6
|
+
let(:subject) { described_class.new_subject }
|
7
|
+
let(:data_predicate) { 'http://example.org/test/name' }
|
8
|
+
let(:string_object_1) { 'Gandhi' }
|
9
|
+
let(:fact_2_with_subject) { described_class.fact_2_with_subject(provenance_subject) }
|
10
|
+
let(:full_fact) { described_class.full_fact }
|
11
|
+
|
12
|
+
describe 'factory works' do
|
13
|
+
it 'with explicit provenance_subject' do
|
14
|
+
fact_2_with_subject.provenance_subject.should be_a(provenance_subject.class)
|
15
|
+
fact_2_with_subject.subject.should be_a(subject.class)
|
16
|
+
fact_2_with_subject.predicate.should be_a(data_predicate.class)
|
17
|
+
fact_2_with_subject.object.should be_a(string_object_1.class)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'without explicit provenance_subject' do
|
21
|
+
described_class.fact_1.provenance_subject.should be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'fact_2_with_subject should not raise_error' do
|
25
|
+
described_class.fact_2_with_subject
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'fact_3_with_subject should not raise_error' do
|
29
|
+
described_class.fact_3_with_subject
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'data_fact' do
|
33
|
+
describe 'without arguments' do
|
34
|
+
it 'has empty provenance_subject' do
|
35
|
+
described_class.data_fact.provenance_subject.should be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'has empty subject' do
|
39
|
+
described_class.data_fact.subject.should be_nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'with provenance_subject' do
|
44
|
+
it 'has provenance_subject' do
|
45
|
+
described_class.data_fact(provenance_subject).
|
46
|
+
provenance_subject.should == provenance_subject
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'has empty subject' do
|
50
|
+
described_class.data_fact(provenance_subject).subject.should be_nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'with provenance_subject and subject' do
|
55
|
+
it 'has provenance_subject' do
|
56
|
+
described_class.data_fact(provenance_subject, subject).
|
57
|
+
provenance_subject.should == provenance_subject
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'has subject' do
|
61
|
+
described_class.data_fact(provenance_subject, subject).
|
62
|
+
subject.should == subject
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'full_fact' do
|
68
|
+
it 'does not fail' do
|
69
|
+
full_fact
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'has values for all attributes' do
|
73
|
+
full_fact.values.all?.should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'is valid (no errors)' do
|
77
|
+
full_fact.errors.should be_empty
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|