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,52 +3,52 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
describe Resource do
|
5
5
|
|
6
|
-
let(:provenance_subject) {
|
6
|
+
let(:provenance_subject) { TestFactories::ProvenanceResource.provenance_resource.subject }
|
7
7
|
|
8
8
|
let(:resource) { described_class.new(provenance_subject: provenance_subject) }
|
9
9
|
|
10
10
|
let(:resource_subject) { resource.subject }
|
11
11
|
|
12
|
-
describe
|
12
|
+
describe 'the fact collection' do
|
13
13
|
|
14
|
-
let(:fact_2_with_subject) {
|
15
|
-
let(:fact_3_with_subject) {
|
16
|
-
let(:fact_without_subject) {
|
17
|
-
let(:fact_with_provenance) {
|
18
|
-
let(:fact_with_resource_subject) {
|
19
|
-
let(:fact_with_provenance_and_resource_subject) {
|
20
|
-
let(:fact_with_incorrect_provenance) {
|
21
|
-
let(:provenance_fact_context) {
|
14
|
+
let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject }
|
15
|
+
let(:fact_3_with_subject) { TestFactories::Fact.fact_3_with_subject }
|
16
|
+
let(:fact_without_subject) { TestFactories::Fact.data_fact }
|
17
|
+
let(:fact_with_provenance) { TestFactories::Fact.data_fact(provenance_subject, nil) }
|
18
|
+
let(:fact_with_resource_subject) { TestFactories::Fact.data_fact(nil, resource_subject) }
|
19
|
+
let(:fact_with_provenance_and_resource_subject) { TestFactories::Fact.data_fact(provenance_subject, resource_subject) }
|
20
|
+
let(:fact_with_incorrect_provenance) { TestFactories::Fact.data_fact(TestFactories::ProvenanceFact.new_subject, resource_subject) }
|
21
|
+
let(:provenance_fact_context) { TestFactories::ProvenanceFact.context }
|
22
22
|
|
23
|
-
it
|
23
|
+
it 'enumerable functions work' do
|
24
24
|
resource.to_a.should == []
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
27
|
+
describe '#<<' do
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'can add a two facts (no subject set)' do
|
30
30
|
resource << fact_without_subject
|
31
31
|
resource << fact_with_provenance
|
32
32
|
resource.size.should == 2
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it 'complains if a provenance_subject is added' do
|
36
36
|
lambda{ resource << provenance_fact_context }.should raise_error(
|
37
37
|
ArgumentError,
|
38
|
-
|
38
|
+
'Trying to add a ProvenanceFact to a Resource.')
|
39
39
|
end
|
40
40
|
|
41
|
-
describe
|
42
|
-
describe
|
43
|
-
describe
|
44
|
-
it
|
41
|
+
describe 'checks and sets subject :' do
|
42
|
+
describe 'adding a fact with subject :' do
|
43
|
+
describe 'when the subject of the fact is equal to the resource_subject' do
|
44
|
+
it 'inserts the fact unaltered' do
|
45
45
|
resource << fact_with_provenance_and_resource_subject
|
46
46
|
resource.first.should be_equal(fact_with_provenance_and_resource_subject)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
describe
|
51
|
-
it
|
50
|
+
describe 'when the subject of the fact is not equal to the resource_subject' do
|
51
|
+
it 'raises a SetOnceError' do
|
52
52
|
lambda{ resource << fact_2_with_subject }.should raise_error(
|
53
53
|
RubyPeterV::SetOnceError,
|
54
54
|
"Value of subject was #{fact_2_with_subject.subject}, " \
|
@@ -57,7 +57,7 @@ module Dbd
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe
|
60
|
+
describe 'adding a fact without subject' do
|
61
61
|
|
62
62
|
before(:each) do
|
63
63
|
resource << fact_with_provenance
|
@@ -67,33 +67,33 @@ module Dbd
|
|
67
67
|
resource.single
|
68
68
|
end
|
69
69
|
|
70
|
-
it
|
70
|
+
it 'insert the same instance' do
|
71
71
|
fact_in_resource.should be_equal(fact_with_provenance)
|
72
72
|
end
|
73
73
|
|
74
|
-
it
|
74
|
+
it 'has kept the other attributes' do
|
75
75
|
(fact_with_provenance.class.attributes - [:subject]).each do |attr|
|
76
76
|
fact_in_resource.send(attr).should == fact_with_provenance.send(attr)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
it
|
80
|
+
it 'has set the subject to the Resource subject' do
|
81
81
|
fact_in_resource.subject.should == resource_subject
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
describe
|
87
|
-
describe
|
88
|
-
describe
|
89
|
-
it
|
86
|
+
describe 'checks and sets provenance_subject :' do
|
87
|
+
describe 'adding a fact with a provenance subject :' do
|
88
|
+
describe 'when the provenance_subject of the fact is equal to the provenance_subject of the resource' do
|
89
|
+
it 'inserts the fact unaltered' do
|
90
90
|
resource << fact_with_provenance_and_resource_subject
|
91
91
|
resource.single.should be_equal(fact_with_provenance_and_resource_subject)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
describe
|
96
|
-
it
|
95
|
+
describe 'when the provenance_subject of the fact is not equal to the resource' do
|
96
|
+
it 'raises a SetOnceError' do
|
97
97
|
lambda{ resource << fact_with_incorrect_provenance }.should raise_error(
|
98
98
|
RubyPeterV::SetOnceError,
|
99
99
|
"Value of provenance_subject was #{fact_with_incorrect_provenance.provenance_subject}, " \
|
@@ -102,7 +102,7 @@ module Dbd
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
describe
|
105
|
+
describe 'adding a fact without provenance_subject' do
|
106
106
|
|
107
107
|
before(:each) do
|
108
108
|
resource << fact_with_resource_subject
|
@@ -110,11 +110,11 @@ module Dbd
|
|
110
110
|
|
111
111
|
let(:fact_in_resource) { resource.single }
|
112
112
|
|
113
|
-
it
|
113
|
+
it 'inserts the same instance' do
|
114
114
|
fact_in_resource.should be_equal(fact_with_resource_subject)
|
115
115
|
end
|
116
116
|
|
117
|
-
it
|
117
|
+
it 'has set the provenance_subject to the Resource provenance_subject' do
|
118
118
|
fact_in_resource.provenance_subject.should == provenance_subject
|
119
119
|
end
|
120
120
|
end
|
@@ -3,29 +3,29 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
describe Resource do
|
5
5
|
|
6
|
-
let(:provenance_subject) {
|
6
|
+
let(:provenance_subject) { TestFactories::ProvenanceResource.provenance_resource.subject }
|
7
7
|
|
8
8
|
let(:resource) { described_class.new(provenance_subject: provenance_subject) }
|
9
9
|
|
10
|
-
describe
|
11
|
-
it
|
12
|
-
described_class.new_subject.should be_a(Fact.new_subject.class)
|
10
|
+
describe '.new_subject' do
|
11
|
+
it 'returns a Fact#new_subject' do
|
12
|
+
described_class.new_subject.should be_a(Fact.factory.new_subject.class)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
17
|
-
describe
|
18
|
-
it
|
16
|
+
describe '.new' do
|
17
|
+
describe 'with a provenance_subject argument' do
|
18
|
+
it 'has created a subject' do
|
19
19
|
resource.subject.should be_a(described_class.new_subject.class)
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'has stored the provenance_subject' do
|
23
23
|
resource.provenance_subject.should == provenance_subject
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
28
|
-
it
|
27
|
+
describe 'with an explicit subject argument' do
|
28
|
+
it 'has stored the given subject' do
|
29
29
|
explicit_subject = described_class.new_subject
|
30
30
|
described_class.new(
|
31
31
|
subject: explicit_subject,
|
@@ -33,8 +33,8 @@ module Dbd
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe
|
37
|
-
it
|
36
|
+
describe 'with a nil provenance_subject argument' do
|
37
|
+
it 'raises a ProvenanceError' do
|
38
38
|
lambda { described_class.new(provenance_subject: nil) } .
|
39
39
|
should raise_error ProvenanceError
|
40
40
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module TestFactories
|
4
|
+
describe Resource do
|
5
|
+
|
6
|
+
let(:provenance_subject) { TestFactories::ProvenanceResource.provenance_resource.subject }
|
7
|
+
|
8
|
+
describe "TestFactories::Resource" do
|
9
|
+
it ".empty works" do
|
10
|
+
described_class.facts_resource(provenance_subject)
|
11
|
+
end
|
12
|
+
|
13
|
+
context ".facts_resource" do
|
14
|
+
it "works with explicit provenance_subject" do
|
15
|
+
described_class.facts_resource(provenance_subject)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "works without explicit provenance_subject" do
|
19
|
+
resource = described_class.facts_resource()
|
20
|
+
resource.provenance_subject.should_not be_nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -3,82 +3,83 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
describe TimeStamp do
|
5
5
|
|
6
|
-
let(:
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
let(:
|
12
|
-
let(:
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
let(:base_time) { Time.utc(2013,5,18,12,0,0)}
|
7
|
+
let(:time_stamp_0) { described_class.new(time: base_time) }
|
8
|
+
let(:time_stamp_1) { described_class.new(time: base_time) }
|
9
|
+
let(:time_stamp_2) { described_class.new(time: base_time + Rational('5_000/1_000_000')) }
|
10
|
+
let(:time_stamp_3) { described_class.new(time: base_time + Rational('5_001/1_000_000')) }
|
11
|
+
let(:time_stamp_4) { described_class.new(time: base_time + Rational('4_999/1_000_000')) }
|
12
|
+
let(:time_stamp_5) { described_class.new(time: base_time + Rational('5_002/1_000_000')) }
|
13
|
+
let(:time_stamp_6) { described_class.new(time: base_time + Rational('4_998/1_000_000')) }
|
14
|
+
|
15
|
+
describe '==' do
|
16
|
+
it 'should be ==' do
|
16
17
|
time_stamp_0.should == time_stamp_1
|
17
18
|
end
|
18
19
|
|
19
|
-
it
|
20
|
+
it 'hash should also be equal' do
|
20
21
|
time_stamp_0.hash.should == time_stamp_1.hash
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
describe
|
25
|
-
it
|
25
|
+
describe 'near?(other)' do
|
26
|
+
it 'is true when the time_stamp is 1000 ns larger' do
|
26
27
|
time_stamp_2.near?(time_stamp_3).should be_true
|
27
28
|
end
|
28
29
|
|
29
|
-
it
|
30
|
+
it 'is true when the time_stamp is 1000 ns smaller' do
|
30
31
|
time_stamp_2.near?(time_stamp_4).should be_true
|
31
32
|
end
|
32
33
|
|
33
|
-
it
|
34
|
+
it 'is false when the time_stamp is 2000 ns larger' do
|
34
35
|
time_stamp_2.near?(time_stamp_5).should_not be_true
|
35
36
|
end
|
36
37
|
|
37
|
-
it
|
38
|
+
it 'is false when the time_stamp is 2000 ns smaller' do
|
38
39
|
time_stamp_2.near?(time_stamp_6).should_not be_true
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
describe
|
43
|
-
it
|
43
|
+
describe '>' do
|
44
|
+
it 'is true if time_stamp is really larger' do
|
44
45
|
time_stamp_2.should > time_stamp_1
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
describe
|
49
|
-
it
|
49
|
+
describe '<' do
|
50
|
+
it 'is true if time_stamp is really smaller' do
|
50
51
|
time_stamp_1.should < time_stamp_2
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
|
-
describe
|
55
|
-
it
|
55
|
+
describe '>=' do
|
56
|
+
it 'is true if time_stamp_2 is really larger' do
|
56
57
|
time_stamp_2.should >= time_stamp_1
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
describe
|
61
|
-
it
|
61
|
+
describe '<=' do
|
62
|
+
it 'is true if time_stamp_1 is really smaller' do
|
62
63
|
time_stamp_1.should <= time_stamp_2
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
describe
|
67
|
-
it
|
67
|
+
describe '+' do
|
68
|
+
it 'returns a larger time_stamp' do
|
68
69
|
(subject + 1).should > subject
|
69
70
|
end
|
70
71
|
|
71
|
-
it
|
72
|
+
it 'sees a difference of 1 nanosecond' do
|
72
73
|
(subject + Rational('1/1000_000_000')).should > subject
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
describe
|
77
|
-
it
|
77
|
+
describe '-' do
|
78
|
+
it 'returns the time difference' do
|
78
79
|
((subject + 1) - subject).should == 1
|
79
80
|
end
|
80
81
|
|
81
|
-
it
|
82
|
+
it 'sees a difference of 1 nanosecond' do
|
82
83
|
((subject + Rational('1/1000_000_000')) - subject).should == Rational('1/1_000_000_000')
|
83
84
|
end
|
84
85
|
end
|
@@ -3,37 +3,41 @@ require 'spec_helper'
|
|
3
3
|
module Dbd
|
4
4
|
describe TimeStamp do
|
5
5
|
|
6
|
-
let(:a_time_stamp) {
|
6
|
+
let(:a_time_stamp) { '2013-05-16 23:52:38.123456789 UTC' }
|
7
7
|
|
8
|
-
describe
|
9
|
-
it
|
10
|
-
a_time_stamp.should match(described_class.
|
8
|
+
describe '.valid_regexp' do
|
9
|
+
it 'matches an example string' do
|
10
|
+
a_time_stamp.should match(described_class.valid_regexp)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'does not match an incorrect string' do
|
14
|
+
('0' + a_time_stamp).should_not match(described_class.valid_regexp)
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
14
|
-
describe
|
15
|
-
it
|
18
|
+
describe '#time to allow comparison' do
|
19
|
+
it 'responds with a time' do
|
16
20
|
described_class.new.time.should be_a(Time)
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
20
|
-
describe
|
21
|
-
it
|
22
|
-
subject.to_s.should match(described_class.
|
24
|
+
describe '#to_s' do
|
25
|
+
it 'returns a Time format string' do
|
26
|
+
subject.to_s.should match(described_class.valid_regexp)
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
26
|
-
describe
|
27
|
-
it
|
30
|
+
describe '.from_s' do
|
31
|
+
it 'returns a TimeStamp' do
|
28
32
|
described_class.new(time: a_time_stamp).should be_a(described_class)
|
29
33
|
end
|
30
34
|
|
31
|
-
it
|
35
|
+
it 'round trips with to_s' do
|
32
36
|
time_stamp = described_class.new(time: a_time_stamp)
|
33
37
|
time_stamp.to_s.should == a_time_stamp
|
34
38
|
end
|
35
39
|
|
36
|
-
it
|
40
|
+
it 'raises ArgumentError is time_zone is not UTC' do
|
37
41
|
time_CET = a_time_stamp.sub(/UTC/, 'CET')
|
38
42
|
lambda{ described_class.new(time: time_CET) }.should raise_error ArgumentError
|
39
43
|
end
|
@@ -2,43 +2,69 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Dbd
|
4
4
|
describe TimeStamp do
|
5
|
-
describe
|
5
|
+
describe '.new' do
|
6
6
|
|
7
|
-
let(:
|
7
|
+
let(:base_time) { Time.utc(2013,5,18,12,0,0)}
|
8
8
|
|
9
|
-
let(:time_string) {
|
9
|
+
let(:time_string) { TestFactories::TimeStamp.fixed_time_string }
|
10
10
|
|
11
11
|
before(:each) do
|
12
|
-
|
13
|
-
Time.stub(:now).and_return(time)
|
12
|
+
Time.stub(:now).and_return(base_time)
|
14
13
|
end
|
15
14
|
|
16
|
-
it
|
15
|
+
it 'creates a new (random) time_stamp' do
|
17
16
|
subject # should_not raise_error
|
18
17
|
end
|
19
18
|
|
20
|
-
it
|
21
|
-
near_future =
|
19
|
+
it 'with :time option given a Time object, sets that to time' do
|
20
|
+
near_future = base_time + 100
|
22
21
|
time_stamp = described_class.new(time: near_future)
|
23
22
|
time_stamp.time.should == near_future
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
25
|
+
it 'with :time option given a String object, sets that to time' do
|
27
26
|
time_stamp = described_class.new(time: time_string)
|
28
27
|
time_stamp.to_s.should == time_string
|
29
28
|
end
|
30
29
|
|
31
|
-
it
|
32
|
-
larger_than = described_class.new(time:
|
30
|
+
it 'with :larger_than, sets a time that is strictly and slightly larger than this' do
|
31
|
+
larger_than = described_class.new(time: base_time + Rational('500/1000_000')) # 0.5 ms
|
33
32
|
time_stamp = described_class.new(larger_than: larger_than)
|
34
33
|
time_stamp.time.should > larger_than.time
|
35
34
|
(time_stamp.time - larger_than.time).should < Rational('1/1000_000') # 1 us
|
36
35
|
end
|
37
36
|
|
38
|
-
it
|
37
|
+
it 'without :larger_than adds some random time to the generated time' do
|
39
38
|
time_stamp = described_class.new
|
40
|
-
time_stamp.time.should >
|
41
|
-
(time_stamp.time -
|
39
|
+
time_stamp.time.should > base_time
|
40
|
+
(time_stamp.time - base_time).should < Rational('1/1000_000') # 1 us
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'using "minimum_time_offset" as a diff for new is always causing strictly larger time_stamp' do
|
44
|
+
time_stamp = described_class.new(time: base_time)
|
45
|
+
minimum_time_offset = nil
|
46
|
+
time_stamp.instance_eval do
|
47
|
+
# read the private variable.
|
48
|
+
# The public API methods "could" be used
|
49
|
+
# (and did expose the problem eventually), but
|
50
|
+
# only with a very low probability due to the
|
51
|
+
# random offset (using a minimum offset,
|
52
|
+
# triggers the issue with much less iterations).
|
53
|
+
minimum_time_offset = minimum_time_offset()
|
54
|
+
end
|
55
|
+
(1..100).each do |i|
|
56
|
+
higher = described_class.new(time: base_time + i * minimum_time_offset)
|
57
|
+
higher.should > time_stamp
|
58
|
+
time_stamp = higher
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'with :time option given a String object, sets that to time for many values' do
|
63
|
+
(0...100).each do |i|
|
64
|
+
time_string = "2013-07-04 18:48:07.26300#{i.to_s.rjust(4,'0')} UTC"
|
65
|
+
time_stamp = described_class.new(time: time_string)
|
66
|
+
time_stamp.to_s.should == time_string
|
67
|
+
end
|
42
68
|
end
|
43
69
|
end
|
44
70
|
end
|