active_attr 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of active_attr might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +3 -2
- data/Guardfile +1 -1
- data/Rakefile +1 -1
- data/active_attr.gemspec +2 -2
- data/gemfiles/rails_head.gemfile +1 -0
- data/lib/active_attr/matchers/have_attribute_matcher.rb +2 -1
- data/lib/active_attr/version.rb +1 -1
- data/spec/functional/active_attr/attributes_spec.rb +4 -4
- data/spec/functional/active_attr/chainable_initialization_spec.rb +2 -2
- data/spec/functional/active_attr/matchers/have_attribute_matcher_spec.rb +92 -76
- data/spec/functional/active_attr/model_spec.rb +6 -6
- data/spec/spec_helper.rb +14 -3
- data/spec/support/mass_assignment_shared_examples.rb +1 -1
- data/spec/unit/active_attr/attributes_spec.rb +2 -2
- data/spec/unit/active_attr/version_spec.rb +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dc8fa69550b2e151dc19682c3121c8a8af38f11
|
4
|
+
data.tar.gz: 2bbe9510e69ce389f4a26d8da23aa217f7e07375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90d657426d8724926c8d8b25eaa0cff6fee7fac91d8426c6dcebb067fe0cdc924585ba3ac78ffc64e8906bde7b93af628f0846cfc648d8c84f6bd99140f7d892
|
7
|
+
data.tar.gz: 865dad5d49f8819da54b3c944267b09e00cf07974f2807d36fd40266fd5c5c740f325107fd10b758c5dddf227db200b0a79d9b02a9edcd7fe9c07a71f45a5f8e
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
2
|
+
--format documentation
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.1.2
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -8,7 +8,8 @@ gem "actionpack", "~> 4.1.0", :group => :test
|
|
8
8
|
gem "protected_attributes", :group => :test
|
9
9
|
|
10
10
|
group :development do
|
11
|
-
gem "debugger",
|
11
|
+
gem "debugger", :platforms => :mri_19
|
12
|
+
gem "debugger2", :platforms => [:mri_20, :mri_21]
|
12
13
|
gem "growl"
|
13
14
|
gem "guard"
|
14
15
|
gem "guard-bundler"
|
@@ -17,7 +18,7 @@ group :development do
|
|
17
18
|
gem "rdiscount"
|
18
19
|
gem "rdoc"
|
19
20
|
gem "ruby-debug", :platforms => :mri_18
|
20
|
-
gem "spec_coverage", :platforms => :mri_19
|
21
|
+
gem "spec_coverage", :platforms => [:mri_19, :mri_20, :mri_21], :git => "https://github.com/getaroom/spec_coverage.git"
|
21
22
|
gem "travis-lint"
|
22
23
|
gem "yard"
|
23
24
|
end
|
data/Guardfile
CHANGED
@@ -3,7 +3,7 @@ guard "bundler" do
|
|
3
3
|
watch(/^.+\.gemspec/)
|
4
4
|
end
|
5
5
|
|
6
|
-
guard "rspec", :cli => "--format
|
6
|
+
guard "rspec", :cli => "--format documentation --debugger" do
|
7
7
|
watch(%r{^spec/.+_spec\.rb$})
|
8
8
|
watch(%r{^lib/(.+)\.rb$}) { |m| ["spec/unit/#{m[1]}_spec.rb", "spec/functional/#{m[1]}_spec.rb"] }
|
9
9
|
watch("spec/spec_helper.rb") { "spec" }
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ task :spec => %w(spec:units spec:functionals)
|
|
11
11
|
namespace :spec do
|
12
12
|
desc "Run RSpec specs with code coverate analysis"
|
13
13
|
RSpec::Core::RakeTask.new(:cov) do |spec|
|
14
|
-
spec.rspec_opts = "--format
|
14
|
+
spec.rspec_opts = "--format documentation --format SpecCoverage"
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "Run RSpec unit specs"
|
data/active_attr.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_development_dependency "bundler", "~> 1.0"
|
22
22
|
gem.add_development_dependency "factory_girl", ">= 2.2", "< 5.0"
|
23
|
-
gem.add_development_dependency "rake", ">= 0.9.0", "< 10.
|
24
|
-
gem.add_development_dependency "rspec", "~>
|
23
|
+
gem.add_development_dependency "rake", ">= 0.9.0", "< 10.4"
|
24
|
+
gem.add_development_dependency "rspec", "~> 3.0"
|
25
25
|
gem.add_development_dependency "tzinfo"
|
26
26
|
end
|
data/gemfiles/rails_head.gemfile
CHANGED
@@ -107,10 +107,11 @@ module ActiveAttr
|
|
107
107
|
|
108
108
|
# @return [String] Negative failure message
|
109
109
|
# @private
|
110
|
-
def
|
110
|
+
def failure_message_when_negated
|
111
111
|
"expected not: #{expected_attribute_definition.inspect}\n" +
|
112
112
|
" got: #{actual_attribute_definition.inspect}"
|
113
113
|
end
|
114
|
+
alias_method :negative_failure_message, :failure_message_when_negated
|
114
115
|
|
115
116
|
private
|
116
117
|
|
data/lib/active_attr/version.rb
CHANGED
@@ -188,8 +188,8 @@ module ActiveAttr
|
|
188
188
|
|
189
189
|
context "defining dangerous attributes" do
|
190
190
|
shared_examples "a dangerous attribute" do
|
191
|
-
it ".dangerous_attribute? is
|
192
|
-
model_class.dangerous_attribute?(attribute_name).should
|
191
|
+
it ".dangerous_attribute? is truthy" do
|
192
|
+
model_class.dangerous_attribute?(attribute_name).should be_truthy
|
193
193
|
end
|
194
194
|
|
195
195
|
it ".attribute raises DangerousAttributeError" do
|
@@ -202,8 +202,8 @@ module ActiveAttr
|
|
202
202
|
end
|
203
203
|
|
204
204
|
shared_examples "a whitelisted attribute" do
|
205
|
-
it ".dangerous_attribute? is
|
206
|
-
model_class.dangerous_attribute?(attribute_name).should
|
205
|
+
it ".dangerous_attribute? is falsey" do
|
206
|
+
model_class.dangerous_attribute?(attribute_name).should be_falsey
|
207
207
|
end
|
208
208
|
|
209
209
|
it ".attribute does not raise" do
|
@@ -9,7 +9,7 @@ module ActiveAttr
|
|
9
9
|
shared_examples "chained initialization" do
|
10
10
|
describe "#initialize" do
|
11
11
|
it { expect { model }.not_to raise_error }
|
12
|
-
it { model.initialized?.should
|
12
|
+
it { model.initialized?.should == true }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -73,7 +73,7 @@ module ActiveAttr
|
|
73
73
|
include_examples "chained initialization"
|
74
74
|
end
|
75
75
|
|
76
|
-
if defined?(BasicObject)
|
76
|
+
if defined?(BasicObject) && BasicObject.superclass.nil?
|
77
77
|
context "mixed into a class that inherits from BasicObject with an argument to initialize" do
|
78
78
|
let :model_class do
|
79
79
|
Class.new(BasicObject) do
|
@@ -30,7 +30,7 @@ module ActiveAttr
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#matches?" do
|
33
|
-
it { matcher.matches?(model_class).should
|
33
|
+
it { matcher.matches?(model_class).should == false }
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "#failure_message" do
|
@@ -52,7 +52,7 @@ module ActiveAttr
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe "#matches?" do
|
55
|
-
it { matcher.matches?(model_class).should
|
55
|
+
it { matcher.matches?(model_class).should == false }
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "#failure_message" do
|
@@ -74,7 +74,7 @@ module ActiveAttr
|
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "#matches?" do
|
77
|
-
it { matcher.matches?(model_class).should
|
77
|
+
it { matcher.matches?(model_class).should == false }
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "#failure_message" do
|
@@ -93,24 +93,26 @@ module ActiveAttr
|
|
93
93
|
before { model_class.attribute :first_name }
|
94
94
|
|
95
95
|
describe "#matches?" do
|
96
|
-
it { matcher.matches?(model_class).should
|
96
|
+
it { matcher.matches?(model_class).should == true }
|
97
97
|
end
|
98
98
|
|
99
|
-
|
100
|
-
|
99
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
100
|
+
describe "##{method}" do
|
101
|
+
before { matcher.matches?(model_class) }
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
it do
|
104
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
105
|
+
expected not: attribute :first_name
|
106
|
+
got: attribute :first_name
|
107
|
+
MESSAGE
|
108
|
+
end
|
107
109
|
end
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
111
113
|
context "a class without the attribute" do
|
112
114
|
describe "#matches?" do
|
113
|
-
it { matcher.matches?(model_class).should
|
115
|
+
it { matcher.matches?(model_class).should == false }
|
114
116
|
end
|
115
117
|
|
116
118
|
describe "#failure_message" do
|
@@ -131,7 +133,7 @@ module ActiveAttr
|
|
131
133
|
before { model_class.attribute :first_name }
|
132
134
|
|
133
135
|
describe "#matches?" do
|
134
|
-
it { matcher.matches?(model_class).should
|
136
|
+
it { matcher.matches?(model_class).should == false }
|
135
137
|
end
|
136
138
|
|
137
139
|
describe "#failure_message" do
|
@@ -150,7 +152,7 @@ module ActiveAttr
|
|
150
152
|
before { model_class.attribute :first_name, :default => "Doe" }
|
151
153
|
|
152
154
|
describe "#matches?" do
|
153
|
-
it { matcher.matches?(model_class).should
|
155
|
+
it { matcher.matches?(model_class).should == false }
|
154
156
|
end
|
155
157
|
|
156
158
|
describe "#failure_message" do
|
@@ -169,17 +171,19 @@ module ActiveAttr
|
|
169
171
|
before { model_class.attribute :first_name, :default => "John" }
|
170
172
|
|
171
173
|
describe "#matches?" do
|
172
|
-
it { matcher.matches?(model_class).should
|
174
|
+
it { matcher.matches?(model_class).should == true }
|
173
175
|
end
|
174
176
|
|
175
|
-
|
176
|
-
|
177
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
178
|
+
describe "##{method}" do
|
179
|
+
before { matcher.matches?(model_class) }
|
177
180
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
181
|
+
it do
|
182
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
183
|
+
expected not: attribute :first_name, :default => "John"
|
184
|
+
got: attribute :first_name, :default => "John"
|
185
|
+
MESSAGE
|
186
|
+
end
|
183
187
|
end
|
184
188
|
end
|
185
189
|
end
|
@@ -195,7 +199,7 @@ module ActiveAttr
|
|
195
199
|
before { model_class.attribute :admin }
|
196
200
|
|
197
201
|
describe "#matches?" do
|
198
|
-
it { matcher.matches?(model_class).should
|
202
|
+
it { matcher.matches?(model_class).should == false }
|
199
203
|
end
|
200
204
|
|
201
205
|
describe "#failure_message" do
|
@@ -214,7 +218,7 @@ module ActiveAttr
|
|
214
218
|
before { model_class.attribute :admin, :default => nil }
|
215
219
|
|
216
220
|
describe "#matches?" do
|
217
|
-
it { matcher.matches?(model_class).should
|
221
|
+
it { matcher.matches?(model_class).should == false }
|
218
222
|
end
|
219
223
|
|
220
224
|
describe "#failure_message" do
|
@@ -233,17 +237,19 @@ module ActiveAttr
|
|
233
237
|
before { model_class.attribute :admin, :default => false }
|
234
238
|
|
235
239
|
describe "#matches?" do
|
236
|
-
it { matcher.matches?(model_class).should
|
240
|
+
it { matcher.matches?(model_class).should == true }
|
237
241
|
end
|
238
242
|
|
239
|
-
|
240
|
-
|
243
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
244
|
+
describe "##{method}" do
|
245
|
+
before { matcher.matches?(model_class) }
|
241
246
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
+
it do
|
248
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
249
|
+
expected not: attribute :admin, :default => false
|
250
|
+
got: attribute :admin, :default => false
|
251
|
+
MESSAGE
|
252
|
+
end
|
247
253
|
end
|
248
254
|
end
|
249
255
|
end
|
@@ -259,17 +265,19 @@ module ActiveAttr
|
|
259
265
|
before { model_class.attribute :first_name }
|
260
266
|
|
261
267
|
describe "#matches?" do
|
262
|
-
it { matcher.matches?(model_class).should
|
268
|
+
it { matcher.matches?(model_class).should == true }
|
263
269
|
end
|
264
270
|
|
265
|
-
|
266
|
-
|
271
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
272
|
+
describe "##{method}" do
|
273
|
+
before { matcher.matches?(model_class) }
|
267
274
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
275
|
+
it do
|
276
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
277
|
+
expected not: attribute :first_name, :default => nil
|
278
|
+
got: attribute :first_name
|
279
|
+
MESSAGE
|
280
|
+
end
|
273
281
|
end
|
274
282
|
end
|
275
283
|
end
|
@@ -278,7 +286,7 @@ module ActiveAttr
|
|
278
286
|
before { model_class.attribute :first_name, :default => false }
|
279
287
|
|
280
288
|
describe "#matches?" do
|
281
|
-
it { matcher.matches?(model_class).should
|
289
|
+
it { matcher.matches?(model_class).should == false }
|
282
290
|
end
|
283
291
|
|
284
292
|
describe "#failure_message" do
|
@@ -297,17 +305,19 @@ module ActiveAttr
|
|
297
305
|
before { model_class.attribute :first_name, :default => nil }
|
298
306
|
|
299
307
|
describe "#matches?" do
|
300
|
-
it { matcher.matches?(model_class).should
|
308
|
+
it { matcher.matches?(model_class).should == true }
|
301
309
|
end
|
302
310
|
|
303
|
-
|
304
|
-
|
311
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
312
|
+
describe "##{method}" do
|
313
|
+
before { matcher.matches?(model_class) }
|
305
314
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
315
|
+
it do
|
316
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
317
|
+
expected not: attribute :first_name, :default => nil
|
318
|
+
got: attribute :first_name, :default => nil
|
319
|
+
MESSAGE
|
320
|
+
end
|
311
321
|
end
|
312
322
|
end
|
313
323
|
end
|
@@ -323,7 +333,7 @@ module ActiveAttr
|
|
323
333
|
before { model_class.attribute :first_name }
|
324
334
|
|
325
335
|
describe "#matches?" do
|
326
|
-
it { matcher.matches?(model_class).should
|
336
|
+
it { matcher.matches?(model_class).should == false }
|
327
337
|
end
|
328
338
|
|
329
339
|
describe "#failure_message" do
|
@@ -342,7 +352,7 @@ module ActiveAttr
|
|
342
352
|
before { model_class.attribute :first_name, :type => Symbol }
|
343
353
|
|
344
354
|
describe "#matches?" do
|
345
|
-
it { matcher.matches?(model_class).should
|
355
|
+
it { matcher.matches?(model_class).should == false }
|
346
356
|
end
|
347
357
|
|
348
358
|
describe "#failure_message" do
|
@@ -361,17 +371,19 @@ module ActiveAttr
|
|
361
371
|
before { model_class.attribute :first_name, :type => String }
|
362
372
|
|
363
373
|
describe "#matches?" do
|
364
|
-
it { matcher.matches?(model_class).should
|
374
|
+
it { matcher.matches?(model_class).should == true }
|
365
375
|
end
|
366
376
|
|
367
|
-
|
368
|
-
|
377
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
378
|
+
describe "##{method}" do
|
379
|
+
before { matcher.matches?(model_class) }
|
369
380
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
381
|
+
it do
|
382
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
383
|
+
expected not: attribute :first_name, :type => String
|
384
|
+
got: attribute :first_name, :type => String
|
385
|
+
MESSAGE
|
386
|
+
end
|
375
387
|
end
|
376
388
|
end
|
377
389
|
end
|
@@ -387,17 +399,19 @@ module ActiveAttr
|
|
387
399
|
before { model_class.attribute :first_name }
|
388
400
|
|
389
401
|
describe "#matches?" do
|
390
|
-
it { matcher.matches?(model_class).should
|
402
|
+
it { matcher.matches?(model_class).should == true }
|
391
403
|
end
|
392
404
|
|
393
|
-
|
394
|
-
|
405
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
406
|
+
describe "##{method}" do
|
407
|
+
before { matcher.matches?(model_class) }
|
395
408
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
409
|
+
it do
|
410
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
411
|
+
expected not: attribute :first_name, :type => Object
|
412
|
+
got: attribute :first_name
|
413
|
+
MESSAGE
|
414
|
+
end
|
401
415
|
end
|
402
416
|
end
|
403
417
|
end
|
@@ -406,7 +420,7 @@ module ActiveAttr
|
|
406
420
|
before { model_class.attribute :first_name, :type => String }
|
407
421
|
|
408
422
|
describe "#matches?" do
|
409
|
-
it { matcher.matches?(model_class).should
|
423
|
+
it { matcher.matches?(model_class).should == false }
|
410
424
|
end
|
411
425
|
|
412
426
|
describe "#failure_message" do
|
@@ -425,17 +439,19 @@ module ActiveAttr
|
|
425
439
|
before { model_class.attribute :first_name, :type => Object }
|
426
440
|
|
427
441
|
describe "#matches?" do
|
428
|
-
it { matcher.matches?(model_class).should
|
442
|
+
it { matcher.matches?(model_class).should == true }
|
429
443
|
end
|
430
444
|
|
431
|
-
|
432
|
-
|
445
|
+
[:negative_failure_message, :failure_message_when_negated].each do |method|
|
446
|
+
describe "##{method}" do
|
447
|
+
before { matcher.matches?(model_class) }
|
433
448
|
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
449
|
+
it do
|
450
|
+
matcher.send(method).should == <<-MESSAGE.strip_heredoc.chomp
|
451
|
+
expected not: attribute :first_name, :type => Object
|
452
|
+
got: attribute :first_name, :type => Object
|
453
|
+
MESSAGE
|
454
|
+
end
|
439
455
|
end
|
440
456
|
end
|
441
457
|
end
|
@@ -36,9 +36,9 @@ module ActiveAttr
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can query attributes" do
|
39
|
-
model.first_name?.should
|
39
|
+
model.first_name?.should eq false
|
40
40
|
model.first_name = "Chris"
|
41
|
-
model.first_name?.should
|
41
|
+
model.first_name?.should == true
|
42
42
|
end
|
43
43
|
|
44
44
|
it "initializes with a block that can use attributes" do
|
@@ -55,14 +55,14 @@ module ActiveAttr
|
|
55
55
|
|
56
56
|
it "has a logger" do
|
57
57
|
logger = double("logger")
|
58
|
-
model_class.logger?.should
|
59
|
-
model.logger?.should
|
58
|
+
model_class.logger?.should eq false
|
59
|
+
model.logger?.should eq false
|
60
60
|
|
61
61
|
model_class.logger = logger
|
62
62
|
|
63
|
-
model_class.logger?.should
|
63
|
+
model_class.logger?.should eq true
|
64
64
|
model_class.logger.should eq logger
|
65
|
-
model.logger?.should
|
65
|
+
model.logger?.should eq true
|
66
66
|
model.logger.should == logger
|
67
67
|
end
|
68
68
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "bundler/setup"
|
2
|
-
require "rspec/autorun"
|
3
2
|
require "active_model/version"
|
4
3
|
|
5
4
|
# Requires supporting files with custom matchers and macros, etc,
|
@@ -7,10 +6,22 @@ require "active_model/version"
|
|
7
6
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |file| require file }
|
8
7
|
|
9
8
|
RSpec.configure do |config|
|
10
|
-
config.
|
11
|
-
config.
|
9
|
+
config.filter_run :focus
|
10
|
+
config.run_all_when_everything_filtered = true
|
12
11
|
|
13
12
|
config.filter_run_excluding :active_model_version => lambda { |requirement|
|
14
13
|
!Gem::Requirement.create(requirement).satisfied_by?(Gem::Version.new(ActiveModel::VERSION::STRING))
|
15
14
|
}
|
15
|
+
|
16
|
+
config.order = :random
|
17
|
+
Kernel.srand config.seed
|
18
|
+
|
19
|
+
config.expect_with :rspec do |expectations|
|
20
|
+
expectations.syntax = [:expect, :should]
|
21
|
+
end
|
22
|
+
|
23
|
+
config.mock_with :rspec do |mocks|
|
24
|
+
mocks.syntax = :should
|
25
|
+
mocks.verify_partial_doubles = true
|
26
|
+
end
|
16
27
|
end
|
@@ -40,7 +40,7 @@ shared_examples "mass assignment method" do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
shared_examples "#
|
43
|
+
shared_examples "#assign_attributes", :assign_attributes => true do
|
44
44
|
def mass_assign_attributes(attributes)
|
45
45
|
person.assign_attributes attributes
|
46
46
|
person
|
@@ -93,7 +93,7 @@ module ActiveAttr
|
|
93
93
|
include Attributes
|
94
94
|
attribute :name
|
95
95
|
attribute :name
|
96
|
-
end.should
|
96
|
+
end.attributes.size.should == 1
|
97
97
|
end
|
98
98
|
|
99
99
|
it "redefining an attribute replaces the attribute definition" do
|
@@ -103,7 +103,7 @@ module ActiveAttr
|
|
103
103
|
attribute :name, :type => String
|
104
104
|
end
|
105
105
|
|
106
|
-
klass.should
|
106
|
+
klass.attributes.size.should eq 1
|
107
107
|
klass.attributes[:name].should == AttributeDefinition.new(:name, :type => String)
|
108
108
|
end
|
109
109
|
end
|
@@ -11,8 +11,8 @@ module ActiveAttr
|
|
11
11
|
let(:gem_version) { Gem::Version.new VERSION }
|
12
12
|
subject(:version) { gem_version }
|
13
13
|
|
14
|
-
it { version.should
|
15
|
-
it { version.should
|
14
|
+
it { version.segments.size.should >= 3 }
|
15
|
+
it { version.segments.size.should <= 5 }
|
16
16
|
|
17
17
|
describe "major version" do
|
18
18
|
subject { gem_version.segments[0] }
|
@@ -36,7 +36,7 @@ module ActiveAttr
|
|
36
36
|
subject(:pre_release_version) { VERSION.split(".")[3] }
|
37
37
|
|
38
38
|
it "is nil or starts with a letter and is alphanumeric" do
|
39
|
-
(pre_release_version.nil? || pre_release_version =~ /^[A-Za-z][0-9A-Za-z]*?/).should
|
39
|
+
(pre_release_version.nil? || pre_release_version =~ /^[A-Za-z][0-9A-Za-z]*?/).should == true
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_attr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Griego
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
version: 0.9.0
|
95
95
|
- - "<"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '10.
|
97
|
+
version: '10.4'
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -104,21 +104,21 @@ dependencies:
|
|
104
104
|
version: 0.9.0
|
105
105
|
- - "<"
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: '10.
|
107
|
+
version: '10.4'
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: rspec
|
110
110
|
requirement: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
112
|
- - "~>"
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: '
|
114
|
+
version: '3.0'
|
115
115
|
type: :development
|
116
116
|
prerelease: false
|
117
117
|
version_requirements: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
119
|
- - "~>"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '
|
121
|
+
version: '3.0'
|
122
122
|
- !ruby/object:Gem::Dependency
|
123
123
|
name: tzinfo
|
124
124
|
requirement: !ruby/object:Gem::Requirement
|