ardm 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile +1 -2
- data/LICENSE +2 -2
- data/README.md +72 -16
- data/ardm.gemspec +1 -0
- data/lib/ardm.rb +2 -1
- data/lib/ardm/active_record.rb +8 -1
- data/lib/ardm/active_record/associations.rb +33 -4
- data/lib/ardm/active_record/base.rb +2 -0
- data/lib/ardm/active_record/collection.rb +5 -0
- data/lib/ardm/active_record/data_mapper_constant.rb +1 -0
- data/lib/ardm/active_record/data_mapper_constant_proxy.rb +24 -0
- data/lib/ardm/active_record/finalize.rb +18 -0
- data/lib/ardm/active_record/predicate_builder/array_handler.rb +10 -16
- data/lib/ardm/active_record/predicate_builder/rails3.rb +42 -15
- data/lib/ardm/active_record/predicate_builder/rails4.rb +39 -13
- data/lib/ardm/active_record/property.rb +24 -12
- data/lib/ardm/active_record/query.rb +9 -18
- data/lib/ardm/active_record/record.rb +54 -11
- data/lib/ardm/active_record/relation.rb +36 -6
- data/lib/ardm/active_record/repository.rb +6 -2
- data/lib/ardm/data_mapper.rb +2 -0
- data/lib/ardm/data_mapper/record.rb +3 -9
- data/lib/ardm/version.rb +1 -1
- data/spec/ardm/datamapper_constants_spec.rb +31 -0
- data/spec/fixtures/article.rb +2 -0
- data/spec/integration/api_key_spec.rb +3 -3
- data/spec/integration/bcrypt_hash_spec.rb +7 -7
- data/spec/integration/comma_separated_list_spec.rb +11 -11
- data/spec/integration/dirty_minder_spec.rb +23 -39
- data/spec/integration/enum_spec.rb +11 -11
- data/spec/integration/epoch_time_spec.rb +6 -6
- data/spec/integration/file_path_spec.rb +23 -23
- data/spec/integration/flag_spec.rb +11 -13
- data/spec/integration/ip_address_spec.rb +15 -15
- data/spec/integration/json_spec.rb +7 -7
- data/spec/integration/slug_spec.rb +6 -6
- data/spec/integration/uri_spec.rb +11 -11
- data/spec/integration/uuid_spec.rb +16 -16
- data/spec/integration/yaml_spec.rb +8 -8
- data/spec/public/model_spec.rb +193 -0
- data/spec/public/property/binary_spec.rb +4 -4
- data/spec/public/property/boolean_spec.rb +3 -3
- data/spec/public/property/class_spec.rb +2 -2
- data/spec/public/property/date_spec.rb +2 -2
- data/spec/public/property/date_time_spec.rb +2 -2
- data/spec/public/property/decimal_spec.rb +2 -2
- data/spec/public/property/discriminator_spec.rb +21 -20
- data/spec/public/property/float_spec.rb +2 -2
- data/spec/public/property/integer_spec.rb +2 -2
- data/spec/public/property/object_spec.rb +14 -13
- data/spec/public/property/serial_spec.rb +2 -2
- data/spec/public/property/string_spec.rb +2 -2
- data/spec/public/property/text_spec.rb +2 -2
- data/spec/public/property/time_spec.rb +2 -2
- data/spec/public/property_spec.rb +44 -48
- data/spec/public/resource_spec.rb +278 -0
- data/spec/schema.rb +33 -4
- data/spec/semipublic/property/boolean_spec.rb +5 -5
- data/spec/semipublic/property/class_spec.rb +3 -3
- data/spec/semipublic/property/date_spec.rb +8 -8
- data/spec/semipublic/property/date_time_spec.rb +9 -9
- data/spec/semipublic/property/decimal_spec.rb +16 -16
- data/spec/semipublic/property/float_spec.rb +16 -16
- data/spec/semipublic/property/integer_spec.rb +16 -16
- data/spec/semipublic/property/lookup_spec.rb +4 -4
- data/spec/semipublic/property/text_spec.rb +2 -2
- data/spec/semipublic/property/time_spec.rb +10 -10
- data/spec/semipublic/property_spec.rb +4 -4
- data/spec/shared/finder_shared_spec.rb +1151 -0
- data/spec/shared/flags_shared_spec.rb +6 -6
- data/spec/shared/identity_function_group.rb +1 -1
- data/spec/shared/public_property_spec.rb +26 -25
- data/spec/shared/resource_spec.rb +1218 -0
- data/spec/shared/semipublic_property_spec.rb +23 -22
- data/spec/spec_helper.rb +17 -0
- data/spec/unit/bcrypt_hash_spec.rb +15 -15
- data/spec/unit/csv_spec.rb +11 -11
- data/spec/unit/dirty_minder_spec.rb +3 -5
- data/spec/unit/enum_spec.rb +17 -17
- data/spec/unit/epoch_time_spec.rb +8 -8
- data/spec/unit/file_path_spec.rb +9 -9
- data/spec/unit/flag_spec.rb +9 -9
- data/spec/unit/ip_address_spec.rb +9 -9
- data/spec/unit/json_spec.rb +11 -11
- data/spec/unit/paranoid_boolean_spec.rb +19 -17
- data/spec/unit/paranoid_datetime_spec.rb +21 -19
- data/spec/unit/regexp_spec.rb +4 -4
- data/spec/unit/uri_spec.rb +8 -8
- data/spec/unit/yaml_spec.rb +9 -9
- metadata +35 -27
- data/lib/ardm/active_record/not_found.rb +0 -7
- data/lib/ardm/data_mapper/not_found.rb +0 -5
@@ -9,17 +9,17 @@ try_spec do
|
|
9
9
|
let(:original_api_key) { subject.api_key }
|
10
10
|
|
11
11
|
it "should have a default value" do
|
12
|
-
original_api_key.
|
12
|
+
expect(original_api_key).not_to be_nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should preserve the default value" do
|
16
|
-
subject.api_key.
|
16
|
+
expect(subject.api_key).to eq(original_api_key)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should generate unique API Keys for each resource" do
|
20
20
|
other_resource = described_class.new(:name => 'eve')
|
21
21
|
|
22
|
-
other_resource.api_key.
|
22
|
+
expect(other_resource.api_key).not_to eq(original_api_key)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -14,8 +14,8 @@ try_spec do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'persists the password on initial save' do
|
17
|
-
@resource.password.
|
18
|
-
@people.last.password.
|
17
|
+
expect(@resource.password).to eq('Ardm R0cks!')
|
18
|
+
expect(@people.last.password).to eq('password1')
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'recalculates password hash on attribute update' do
|
@@ -23,23 +23,23 @@ try_spec do
|
|
23
23
|
@resource.save
|
24
24
|
|
25
25
|
@resource.reload
|
26
|
-
@resource.password.
|
27
|
-
@resource.password.
|
26
|
+
expect(@resource.password).to eq('bcryptic obscure')
|
27
|
+
expect(@resource.password).not_to eq('Ardm R0cks!')
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'does not change password value on reload' do
|
31
31
|
resource = @people.last
|
32
32
|
original = resource.password.to_s
|
33
33
|
resource.reload
|
34
|
-
resource.password.to_s.
|
34
|
+
expect(resource.password.to_s).to eq(original)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'uses cost of BCrypt::Engine::DEFAULT_COST' do
|
38
|
-
@resource.password.cost.
|
38
|
+
expect(@resource.password.cost).to eq(BCrypt::Engine::DEFAULT_COST)
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'allows Bcrypt::Password#hash to be an Integer' do
|
42
|
-
@resource.password.hash.
|
42
|
+
expect(@resource.password.hash).to be_kind_of(Integer)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -16,12 +16,12 @@ try_spec do
|
|
16
16
|
|
17
17
|
describe 'when dumped and loaded again' do
|
18
18
|
before do
|
19
|
-
@resource.save.
|
19
|
+
expect(@resource.save).to be true
|
20
20
|
@resource.reload
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'has no interests' do
|
24
|
-
@resource.interests.
|
24
|
+
expect(@resource.interests).to eq(nil)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -33,22 +33,22 @@ try_spec do
|
|
33
33
|
|
34
34
|
describe 'when dumped and loaded again' do
|
35
35
|
before do
|
36
|
-
@resource.save.
|
36
|
+
expect(@resource.save).to be true
|
37
37
|
@resource.reload
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'has empty interests list' do
|
41
|
-
@resource.interests.
|
41
|
+
expect(@resource.interests).to eq([])
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'with interests information given as a Hash' do
|
47
47
|
it 'raises ArgumentError' do
|
48
|
-
|
48
|
+
expect do
|
49
49
|
@resource.interests = { :hash => 'value' }
|
50
50
|
@resource.save
|
51
|
-
end.
|
51
|
+
end.to raise_error(ArgumentError, /must be a string, an array or nil/)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -60,24 +60,24 @@ try_spec do
|
|
60
60
|
|
61
61
|
describe 'when dumped and loaded again' do
|
62
62
|
before do
|
63
|
-
@resource.save.
|
63
|
+
expect(@resource.save).to be true
|
64
64
|
@resource.reload
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'includes "fire" in interests' do
|
68
|
-
@resource.interests.
|
68
|
+
expect(@resource.interests).to include('fire')
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'includes "water" in interests' do
|
72
|
-
@resource.interests.
|
72
|
+
expect(@resource.interests).to include('water')
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'includes "a whole lot of other interesting things" in interests' do
|
76
|
-
@resource.interests.
|
76
|
+
expect(@resource.interests).to include('a whole lot of other interesting things')
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'has blank entries removed' do
|
80
|
-
@resource.interests.any? { |i| Ardm::Ext.blank?(i) }.
|
80
|
+
expect(@resource.interests.any? { |i| Ardm::Ext.blank?(i) }).to be false
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -29,53 +29,45 @@ try_spec do
|
|
29
29
|
}
|
30
30
|
@resource.save!
|
31
31
|
@resource.reload
|
32
|
-
@resource.positions['title'].
|
32
|
+
expect(@resource.positions['title']).to eq('Layperson')
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "when I change positions" do
|
36
36
|
before :each do
|
37
|
-
@resource.changed
|
37
|
+
expect(@resource.changed?).to eq(false)
|
38
38
|
@resource.positions['title'] = 'Chief Layer of People'
|
39
39
|
@resource.save!
|
40
40
|
@resource.reload
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should remember the new position" do
|
44
|
-
@resource.positions['title'].
|
44
|
+
expect(@resource.positions['title']).to eq('Chief Layer of People')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "when I add a new attribute of the position" do
|
49
49
|
before :each do
|
50
|
-
@resource.changed
|
50
|
+
expect(@resource.changed?).to eq(false)
|
51
51
|
@resource.positions['pays_buttloads_of_money'] = true
|
52
52
|
@resource.save!
|
53
53
|
@resource.reload
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should remember the new attribute" do
|
57
|
-
@resource.positions['pays_buttloads_of_money'].
|
57
|
+
expect(@resource.positions['pays_buttloads_of_money']).to be true
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe "when I change the details of the position" do
|
62
62
|
before :each do
|
63
|
-
@resource.changed
|
63
|
+
expect(@resource.changed?).to eq(false)
|
64
64
|
@resource.positions['details'].merge!('awesome' => "VERY TRUE")
|
65
65
|
@resource.save!
|
66
66
|
@resource.reload
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should remember the changed detail" do
|
70
|
-
|
71
|
-
#pending "not supported (YET)" do
|
72
|
-
# TODO: Not supported (yet?) -- this is a much harder problem to
|
73
|
-
# solve: using mutating accessors of nested objects. We could
|
74
|
-
# detect it from #dirty? (using the #hash method), but #dirty?
|
75
|
-
# only returns the status of known-mutated properties (not full,
|
76
|
-
# on-demand scan of object dirty-ness).
|
77
|
-
@resource.positions['details']['awesome'].should == 'VERY TRUE'
|
78
|
-
#end
|
70
|
+
expect(@resource.positions['details']['awesome']).to eq('VERY TRUE')
|
79
71
|
end
|
80
72
|
end
|
81
73
|
|
@@ -86,8 +78,8 @@ try_spec do
|
|
86
78
|
end
|
87
79
|
|
88
80
|
it "should reflect the previously set/persisted value" do
|
89
|
-
@resource.positions.
|
90
|
-
@resource.positions['title'].
|
81
|
+
expect(@resource.positions).not_to be_nil
|
82
|
+
expect(@resource.positions['title']).to eq('Layperson')
|
91
83
|
end
|
92
84
|
end
|
93
85
|
|
@@ -103,25 +95,25 @@ try_spec do
|
|
103
95
|
]
|
104
96
|
@resource.save!
|
105
97
|
@resource.reload
|
106
|
-
@resource.positions.first['title'].
|
98
|
+
expect(@resource.positions.first['title']).to eq('Layperson')
|
107
99
|
end
|
108
100
|
|
109
101
|
describe "when I remove the position" do
|
110
102
|
before :each do
|
111
|
-
@resource.changed
|
103
|
+
expect(@resource.changed?).to eq(false)
|
112
104
|
@resource.positions.pop
|
113
105
|
@resource.save!
|
114
106
|
@resource.reload
|
115
107
|
end
|
116
108
|
|
117
109
|
it "should know there aren't any positions" do
|
118
|
-
@resource.positions.
|
110
|
+
expect(@resource.positions).to eq([])
|
119
111
|
end
|
120
112
|
end
|
121
113
|
|
122
114
|
describe "when I add a new position" do
|
123
115
|
before :each do
|
124
|
-
@resource.changed
|
116
|
+
expect(@resource.changed?).to eq(false)
|
125
117
|
@resource.positions << {
|
126
118
|
'company' => "Down and Dirty, LP",
|
127
119
|
'title' => "Porn Star",
|
@@ -132,12 +124,12 @@ try_spec do
|
|
132
124
|
end
|
133
125
|
|
134
126
|
it "should know there's two positions" do
|
135
|
-
@resource.positions.length.
|
127
|
+
expect(@resource.positions.length).to eq(2)
|
136
128
|
end
|
137
129
|
|
138
130
|
it "should know which position is which" do
|
139
|
-
@resource.positions.first['title'].
|
140
|
-
@resource.positions.last['title'].
|
131
|
+
expect(@resource.positions.first['title']).to eq("Layperson")
|
132
|
+
expect(@resource.positions.last['title']).to eq("Porn Star")
|
141
133
|
end
|
142
134
|
|
143
135
|
describe "when I change the details of one of the positions" do
|
@@ -148,35 +140,27 @@ try_spec do
|
|
148
140
|
end
|
149
141
|
|
150
142
|
it "should remember the changed detail" do
|
151
|
-
|
152
|
-
#pending "not supported (YET)" do
|
153
|
-
# TODO: Not supported (yet?) -- this is a much harder problem to
|
154
|
-
# solve: using mutating accessors of nested objects. We could
|
155
|
-
# detect it from #dirty? (using the #hash method), but #dirty?
|
156
|
-
# only returns the status of known-mutated properties (not full,
|
157
|
-
# on-demand scan of object dirty-ness).
|
158
|
-
@resource.positions.last['details']['high_risk'].should == true
|
159
|
-
#end
|
143
|
+
expect(@resource.positions.last['details']['high_risk']).to eq(true)
|
160
144
|
end
|
161
145
|
end
|
162
146
|
end # when I add a new position
|
163
147
|
|
164
148
|
describe "when I remove the position with a block-based mutator" do
|
165
149
|
before :each do
|
166
|
-
@resource.changed
|
150
|
+
expect(@resource.changed?).to eq(false)
|
167
151
|
@resource.positions.reject! { |_| true }
|
168
152
|
@resource.save!
|
169
153
|
@resource.reload
|
170
154
|
end
|
171
155
|
|
172
156
|
it "should know there aren't any positions" do
|
173
|
-
@resource.positions.
|
157
|
+
expect(@resource.positions).to eq([])
|
174
158
|
end
|
175
159
|
end
|
176
160
|
|
177
161
|
describe "when I mutate positions through a reference" do
|
178
162
|
before :each do
|
179
|
-
@resource.changed
|
163
|
+
expect(@resource.changed?).to eq(false)
|
180
164
|
@positions = @resource.positions
|
181
165
|
@positions << {
|
182
166
|
'company' => "Ooga Booga, Inc",
|
@@ -185,9 +169,9 @@ try_spec do
|
|
185
169
|
end
|
186
170
|
|
187
171
|
it "should reflect the change in both the property and the reference" do
|
188
|
-
@resource.positions.length.
|
189
|
-
@resource.positions.last['title'].
|
190
|
-
@positions.last['title'].
|
172
|
+
expect(@resource.positions.length).to eq(2)
|
173
|
+
expect(@resource.positions.last['title']).to eq('Rocker')
|
174
|
+
expect(@positions.last['title']).to eq('Rocker')
|
191
175
|
end
|
192
176
|
end
|
193
177
|
|
@@ -14,12 +14,12 @@ try_spec do
|
|
14
14
|
:status => 'confirmed'
|
15
15
|
)
|
16
16
|
|
17
|
-
@resource.save.
|
17
|
+
expect(@resource.save).to be true
|
18
18
|
@resource.reload
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'preserves property value' do
|
22
|
-
@resource.status.
|
22
|
+
expect(@resource.status).to eq(:confirmed)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -29,7 +29,7 @@ try_spec do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'typecasts it for outside reader' do
|
32
|
-
@resource.status.
|
32
|
+
expect(@resource.status).to eq(:assigned)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -41,17 +41,17 @@ try_spec do
|
|
41
41
|
:body => "Note that at the very least, there should be a check to see whether or not the user is created before chown'ing a file to the user.",
|
42
42
|
:status => 'confirmed'
|
43
43
|
)
|
44
|
-
@resource.save.
|
44
|
+
expect(@resource.save).to be true
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'supports queries with equality operator on enumeration property' do
|
48
|
-
Ardm::Fixtures::Ticket.where(:status => :confirmed).
|
49
|
-
|
48
|
+
expect(Ardm::Fixtures::Ticket.where(:status => :confirmed)).
|
49
|
+
to include(@resource)
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'supports queries with inequality operator on enumeration property' do
|
53
|
-
Ardm::Fixtures::Ticket.where
|
54
|
-
|
53
|
+
expect(Ardm::Fixtures::Ticket.where(:status.not => :confirmed)).
|
54
|
+
not_to include(@resource)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -64,15 +64,15 @@ try_spec do
|
|
64
64
|
# TODO: consider sharing shared spec exampels with dm-validations,
|
65
65
|
# which has 'invalid model' shared group
|
66
66
|
it 'is invalid (auto validation for :within kicks in)' do
|
67
|
-
@resource.
|
67
|
+
expect(@resource).not_to be_valid
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'has errors' do
|
71
|
-
@resource.errors.
|
71
|
+
expect(@resource.errors).not_to be_empty
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'has a meaningful error message on invalid property' do
|
75
|
-
@resource.errors[:status].
|
75
|
+
expect(@resource.errors[:status]).to include('must be one of unconfirmed, confirmed, assigned, resolved, not_applicable')
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -16,18 +16,18 @@ try_spec do
|
|
16
16
|
|
17
17
|
describe 'after typecasting string input' do
|
18
18
|
it 'has a valid birthday' do
|
19
|
-
@resource.birthday.
|
19
|
+
expect(@resource.birthday).to eq(::Time.parse('1983-05-03'))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'when dumped and loaded again' do
|
24
24
|
before do
|
25
|
-
@resource.save.
|
25
|
+
expect(@resource.save).to be true
|
26
26
|
@resource.reload
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'has a valid birthday' do
|
30
|
-
@resource.birthday.
|
30
|
+
expect(@resource.birthday).to eq(::Time.parse('1983-05-03'))
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -39,18 +39,18 @@ try_spec do
|
|
39
39
|
|
40
40
|
describe 'after typecasting nil' do
|
41
41
|
it 'has a nil value for birthday' do
|
42
|
-
@resource.birthday.
|
42
|
+
expect(@resource.birthday).to be_nil
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'when dumped and loaded again' do
|
47
47
|
before do
|
48
|
-
@resource.save.
|
48
|
+
expect(@resource.save).to be true
|
49
49
|
@resource.reload
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'has a nil value for birthday' do
|
53
|
-
@resource.birthday.
|
53
|
+
expect(@resource.birthday).to be_nil
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -16,31 +16,31 @@ try_spec do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'points to original path' do
|
19
|
-
@resource.source_path.to_s.
|
19
|
+
expect(@resource.source_path.to_s).to eq(@source_path)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'responds to :directory?' do
|
23
|
-
@resource.source_path.
|
23
|
+
expect(@resource.source_path).to respond_to(:directory?)
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'responds to :file?' do
|
27
|
-
@resource.source_path.
|
27
|
+
expect(@resource.source_path).to respond_to(:file?)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'responds to :dirname' do
|
31
|
-
@resource.source_path.
|
31
|
+
expect(@resource.source_path).to respond_to(:dirname)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'responds to :absolute?' do
|
35
|
-
@resource.source_path.
|
35
|
+
expect(@resource.source_path).to respond_to(:absolute?)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'responds to :readable?' do
|
39
|
-
@resource.source_path.
|
39
|
+
expect(@resource.source_path).to respond_to(:readable?)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'responds to :size' do
|
43
|
-
@resource.source_path.
|
43
|
+
expect(@resource.source_path).to respond_to(:size)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -53,36 +53,36 @@ try_spec do
|
|
53
53
|
|
54
54
|
describe 'when saved and reloaded' do
|
55
55
|
before do
|
56
|
-
@resource.save.
|
56
|
+
expect(@resource.save).to be true
|
57
57
|
@resource.reload
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'points to original path' do
|
61
|
-
@resource.destination_path.to_s.
|
61
|
+
expect(@resource.destination_path.to_s).to eq(@destination_path)
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'responds to :directory?' do
|
65
|
-
@resource.destination_path.
|
65
|
+
expect(@resource.destination_path).to respond_to(:directory?)
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'responds to :file?' do
|
69
|
-
@resource.destination_path.
|
69
|
+
expect(@resource.destination_path).to respond_to(:file?)
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'responds to :dirname' do
|
73
|
-
@resource.destination_path.
|
73
|
+
expect(@resource.destination_path).to respond_to(:dirname)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'responds to :absolute?' do
|
77
|
-
@resource.destination_path.
|
77
|
+
expect(@resource.destination_path).to respond_to(:absolute?)
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'responds to :readable?' do
|
81
|
-
@resource.destination_path.
|
81
|
+
expect(@resource.destination_path).to respond_to(:readable?)
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'responds to :size' do
|
85
|
-
@resource.destination_path.
|
85
|
+
expect(@resource.destination_path).to respond_to(:size)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -95,12 +95,12 @@ try_spec do
|
|
95
95
|
|
96
96
|
describe 'when saved and reloaded' do
|
97
97
|
before do
|
98
|
-
@resource.save.
|
98
|
+
expect(@resource.save).to be true
|
99
99
|
@resource.reload
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'has nil source path' do
|
103
|
-
@resource.source_path.
|
103
|
+
expect(@resource.source_path).to be_nil
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
@@ -113,12 +113,12 @@ try_spec do
|
|
113
113
|
|
114
114
|
describe 'when saved and reloaded' do
|
115
115
|
before do
|
116
|
-
@resource.save.
|
116
|
+
expect(@resource.save).to be true
|
117
117
|
@resource.reload
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'has nil source path' do
|
121
|
-
@resource.source_path.
|
121
|
+
expect(@resource.source_path).to be_nil
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -131,12 +131,12 @@ try_spec do
|
|
131
131
|
|
132
132
|
describe 'when saved and reloaded' do
|
133
133
|
before do
|
134
|
-
@resource.save.
|
134
|
+
expect(@resource.save).to be true
|
135
135
|
@resource.reload
|
136
136
|
end
|
137
137
|
|
138
138
|
it 'has nil source path' do
|
139
|
-
@resource.source_path.
|
139
|
+
expect(@resource.source_path).to be_nil
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
@@ -148,9 +148,9 @@ try_spec do
|
|
148
148
|
|
149
149
|
describe 'when instantiated' do
|
150
150
|
it 'raises an exception' do
|
151
|
-
|
151
|
+
expect do
|
152
152
|
Ardm::Fixtures::SoftwarePackage.new(:source_path => @source_path)
|
153
|
-
end.
|
153
|
+
end.to raise_error(TypeError)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|