summaryrefslogtreecommitdiff
path: root/spec/hashie/extensions/ignore_undeclared_spec.rb
diff options
context:
space:
mode:
authorMichael Herold <opensource@michaeljherold.com>2020-10-29 19:49:08 -0500
committerGitHub <noreply@github.com>2020-10-29 19:49:08 -0500
commit75410a6657090348de7bff3e5eab8aa684e49c38 (patch)
tree27e0eab23a209706b738bcfcf5736220fc3ac871 /spec/hashie/extensions/ignore_undeclared_spec.rb
parent59d04c851e8ae80d82e93d82059e591eaa7718a7 (diff)
parentf152e25912d0b93ff08b8964eb757200ad4b6f32 (diff)
downloadhashie-75410a6657090348de7bff3e5eab8aa684e49c38.tar.gz
Merge pull request #537 from michaelherold/dash-consistency
Fix inconsistencies with Dash defaults
Diffstat (limited to 'spec/hashie/extensions/ignore_undeclared_spec.rb')
-rw-r--r--spec/hashie/extensions/ignore_undeclared_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/hashie/extensions/ignore_undeclared_spec.rb b/spec/hashie/extensions/ignore_undeclared_spec.rb
index 50c4f31..6f2d818 100644
--- a/spec/hashie/extensions/ignore_undeclared_spec.rb
+++ b/spec/hashie/extensions/ignore_undeclared_spec.rb
@@ -27,6 +27,18 @@ describe Hashie::Extensions::IgnoreUndeclared do
hash = subject.new(city: 'Toronto')
expect { hash.country = 'Canada' }.to raise_error(NoMethodError)
end
+
+ context 'with a default value' do
+ let(:test) do
+ Class.new(Hashie::Trash) do
+ include Hashie::Extensions::IgnoreUndeclared
+
+ property :description, from: :desc, default: ''
+ end
+ end
+
+ include_examples 'Dash default handling', :description, :desc
+ end
end
context 'combined with DeepMerge' do