summaryrefslogtreecommitdiff
path: root/spec/hashie/extensions/method_access_spec.rb
diff options
context:
space:
mode:
authorZloy <zhoran@inbox.ru>2015-01-14 06:56:43 -0500
committerdB <dblock@dblock.org>2015-01-14 06:56:43 -0500
commitc2225e0d261e570f6a56a5cfb772e548ff7af42b (patch)
tree5fd50ceb1bc9e87d259ecf720a250504bcb081e3 /spec/hashie/extensions/method_access_spec.rb
parenteeba6ee3af413c8623fdb55864a6eb33d907e743 (diff)
downloadhashie-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.rb8
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)