Permalink
Browse files

fix the respond_to? method on the rest resource + add a spec for it

  • Loading branch information...
drouchy committed Nov 13, 2013
1 parent 8164c05 commit 19d4289ea089b22c1301883c2a907eb34af707d8
Showing with 12 additions and 3 deletions.
  1. +1 −2 lib/shutl/resource/rest.rb
  2. +1 −1 lib/shutl/resource/version.rb
  3. +10 −0 spec/rest_resource_spec.rb
@@ -61,10 +61,9 @@ def method_missing(method, *args, &block)
end
def respond_to? method
- attributes.has_key?(method) ? true : super
+ attributes.has_key?(String(method)) ? true : super
end
-
def next_resource
pagination["next_resource"] if pagination
end
@@ -1,5 +1,5 @@
module Shutl
module Resource
- VERSION = '1.5.0'
+ VERSION = '1.5.1'
end
end
View
@@ -470,5 +470,15 @@ def stub_post status
end
end
+ describe '#respond_to?' do
+ subject { TestRest.new a:1, b:2 }
+ it 'responds to a getter if it has an attribute' do
+ subject.respond_to?(:a).should be_true
+ end
+
+ it 'does not responsd to a getter if there is no attributes' do
+ subject.respond_to?(:foo).should be_false
+ end
+ end
end

0 comments on commit 19d4289

Please sign in to comment.