diff options
author | Zloy <zhoran@inbox.ru> | 2015-01-14 06:56:43 -0500 |
---|---|---|
committer | dB <dblock@dblock.org> | 2015-01-14 06:56:43 -0500 |
commit | c2225e0d261e570f6a56a5cfb772e548ff7af42b (patch) | |
tree | 5fd50ceb1bc9e87d259ecf720a250504bcb081e3 /spec/hashie/extensions/method_access_spec.rb | |
parent | eeba6ee3af413c8623fdb55864a6eb33d907e743 (diff) | |
download | hashie-c2225e0d261e570f6a56a5cfb772e548ff7af42b.tar.gz |
Methods such as abc? return true/false Hashie::Extensions::MethodReader.
Diffstat (limited to 'spec/hashie/extensions/method_access_spec.rb')
-rw-r--r-- | spec/hashie/extensions/method_access_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/hashie/extensions/method_access_spec.rb b/spec/hashie/extensions/method_access_spec.rb index 4115f9d..b48b4e1 100644 --- a/spec/hashie/extensions/method_access_spec.rb +++ b/spec/hashie/extensions/method_access_spec.rb @@ -29,6 +29,14 @@ describe Hashie::Extensions::MethodReader do expect { subject.new.awesome }.to raise_error(NoMethodError) end + it 'returns false for undefined keys if key with question has been called ' do + expect(subject.new.awesome?).to eq false + end + + it 'returns true for defined keys if key with question has been called' do + expect(subject.new(awesome: 'sauce').awesome?).to eq true + end + describe '#respond_to?' do it 'is true for string keys' do expect(subject.new('awesome' => 'sauce')).to be_respond_to(:awesome) |