Skip to content

Commit

Permalink
reenabling returning nil for non existend properties/attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
jwagener committed Apr 13, 2011
1 parent 4b0a1a0 commit bb87c72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 1 addition & 3 deletions lib/soundcloud/hash_response_wrapper.rb
@@ -1,9 +1,7 @@
class Soundcloud::HashResponseWrapper < Hashie::Mash
attr_reader :response
def initialize(response, *args)
super(response, *args) do |x|
raise NoMethodError
end
super(response, *args)
@response = response
end
end
7 changes: 1 addition & 6 deletions spec/soundcloud/hash_response_wrapper_spec.rb
Expand Up @@ -5,13 +5,8 @@
it "should provide a Mash with accessors for the key/values of the passed response" do
Soundcloud::HashResponseWrapper.new({:foo => 'bar'}).foo.should == 'bar'
end

it "should not have nil accessors for non present keys" do
Soundcloud::HashResponseWrapper.new({:foo => 'bar'}).should raise_error
end

end

describe '#response' do
it "should return the original response object" do
Soundcloud::HashResponseWrapper.new({:foo => 'bar'}).response.should == {:foo => 'bar'}
Expand Down

0 comments on commit bb87c72

Please sign in to comment.