summaryrefslogtreecommitdiff
path: root/spec/hashie/dash_spec.rb
diff options
context:
space:
mode:
authorMichael Herold <opensource@michaeljherold.com>2020-10-23 21:57:10 -0500
committerMichael Herold <>2020-10-23 21:57:10 -0500
commitf152e25912d0b93ff08b8964eb757200ad4b6f32 (patch)
treed357a27b5b2b8408d87f6d400cb5fe8d52259d8c /spec/hashie/dash_spec.rb
parent14e923d899183595abb5ee096c29e1de707fcc04 (diff)
downloadhashie-f152e25912d0b93ff08b8964eb757200ad4b6f32.tar.gz
Fix inconsistencies with Dash defaults
The normal behavior of Dash with respect to property defaults differed from the behavior of a Dash/Trash with IgnoreUndeclared mixed in. This is because some situations called the defaults and some did not. This change normalizes the behavior so that all situations where the defaults should be used to override unset values behave consistently, as well as all situations where the default should not override a `nil` value.
Diffstat (limited to 'spec/hashie/dash_spec.rb')
-rw-r--r--spec/hashie/dash_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/hashie/dash_spec.rb b/spec/hashie/dash_spec.rb
index 5f3bfe3..3adfc8f 100644
--- a/spec/hashie/dash_spec.rb
+++ b/spec/hashie/dash_spec.rb
@@ -606,3 +606,13 @@ context 'with method access' do
it { is_expected.to eq true }
end
end
+
+RSpec.describe Hashie::Dash do
+ let(:test) do
+ Class.new(Hashie::Dash) do
+ property :description, default: ''
+ end
+ end
+
+ include_examples 'Dash default handling', :description
+end