smart_properties 1.6.1 → 1.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b925a25ffc3986a157e22c2b1e15d14fffe83ac2
4
- data.tar.gz: 257d8a8aa05874ae0dcc43c00a60142c4fd809b7
3
+ metadata.gz: 8e43f13ab772a153c4729a1f20be52f140934555
4
+ data.tar.gz: 5dab533362b6132ee4b67c4eaef9269d957b4211
5
5
  SHA512:
6
- metadata.gz: 6ad62801456bd554a4cf3984438490d4dadb9054a29a9dd16d4ffc87206a3a1d1abbeee25fdffc60810a5d1451b390882541f5b5540f2230d32b19f6f3828d24
7
- data.tar.gz: d2557a94805341d73a358bacb2c3b0daa9a5c2916bc288789c7db2a0c0d4f28eb0b2890d075ec56cfde6f0dc3be3770a74a916ea673183e66712361d2f728335
6
+ metadata.gz: 3b3c1e442d65b38c7571a2380b9bbdc643dd6f3b3d9931be1edeafcd3f9eedf9432e0637ce585e6a2d383274a3090eae0bde5473c461dcb7a1346ff3671769cb
7
+ data.tar.gz: 80ebfc6a118202f954e7b347b8685132e23478bbc9f9ef4e8dbd0d34bb5d98f009f71fab9b4f213f9618938c1d62b6de762989b4e89ef9c70224e22468b5e15d
@@ -21,7 +21,7 @@
21
21
  # :required => true
22
22
  #
23
23
  module SmartProperties
24
- VERSION = "1.6.1"
24
+ VERSION = "1.7.0"
25
25
 
26
26
  class Error < ::ArgumentError; end
27
27
  class ConfigurationError < Error; end
@@ -339,7 +339,7 @@ module SmartProperties
339
339
 
340
340
  # Check presence of all required properties
341
341
  faulty_properties =
342
- properties.select { |_, property| property.required?(self) && send(property.name).nil? }.map(&:last)
342
+ properties.select { |_, property| property.required?(self) && instance_variable_get("@#{property.name}").nil? }.map(&:last)
343
343
  unless faulty_properties.empty?
344
344
  error = SmartProperties::InitializationError.new(self, faulty_properties)
345
345
  raise error
@@ -431,6 +431,28 @@ describe SmartProperties do
431
431
  end
432
432
  end
433
433
 
434
+ context 'when used to build a class that has a required property with no default called :text whose getter is overriden' do
435
+ subject(:klass) do
436
+ Class.new.tap do |c|
437
+ c.send(:include, described_class)
438
+
439
+ c.instance_eval do
440
+ property :text, required: true
441
+ end
442
+
443
+ c.class_eval do
444
+ def text
445
+ "<em>#{super}</em>"
446
+ end
447
+ end
448
+ end
449
+ end
450
+
451
+ it "should raise an error during initilization if no value for :text has been specified" do
452
+ expect { klass.new }.to raise_error(SmartProperties::InitializationError)
453
+ end
454
+ end
455
+
434
456
  context 'when used to build a class that has a property called :id whose default value is a lambda statement for retrieving the object_id' do
435
457
  subject(:klass) do
436
458
  Class.new.tap do |c|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_properties
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Tennhard