Sha256: 31bb04fe51fe3ef54ac4379a70a6cfc8cd7eefd4f1dd0626e05f724892054bcf
Contents?: true
Size: 702 Bytes
Versions: 3
Compression:
Stored size: 702 Bytes
Contents
require 'spec_helper' describe Hashie::Extensions::IgnoreUndeclared do class ForgivingTrash < Hashie::Trash include Hashie::Extensions::IgnoreUndeclared property :city property :state, from: :provence end subject { ForgivingTrash } it 'silently ignores undeclared properties on initialization' do expect { subject.new(city: 'Toronto', provence: 'ON', country: 'Canada') }.to_not raise_error end it 'works with translated properties (with symbol keys)' do expect(subject.new(provence: 'Ontario').state).to eq('Ontario') end it 'works with translated properties (with string keys)' do expect(subject.new(provence: 'Ontario').state).to eq('Ontario') end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hashie-2.1.2 | spec/hashie/extensions/ignore_undeclared_spec.rb |
hashie-2.1.1 | spec/hashie/extensions/ignore_undeclared_spec.rb |
hashie-2.1.0 | spec/hashie/extensions/ignore_undeclared_spec.rb |