gds-api-adapters 0.0.28 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,10 +29,10 @@ module GdsApi
29
29
  end
30
30
  end
31
31
 
32
- def respond_to_missing?(method)
33
- true
32
+ def respond_to_missing?(method, include_private)
33
+ to_hash.has_key?(method.to_s)
34
34
  end
35
-
35
+
36
36
  private
37
37
 
38
38
  def self.build_ostruct_recursively(value)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '0.0.28'
2
+ VERSION = '0.0.29'
3
3
  end
@@ -91,7 +91,14 @@ class JsonClientTest < MiniTest::Spec
91
91
  assert_equal nil, response.does_not_exist
92
92
  end
93
93
 
94
-
94
+ def test_response_does_not_claim_to_respond_to_methods_corresponding_to_non_existent_attributes
95
+ # This mimics the behaviour of OpenStruct
96
+ url = "http://some.endpoint/some.json"
97
+ stub_request(:put, url).to_return(:body => '{"a":1}', :status => 200)
98
+ response = @client.put_json(url, {})
99
+ assert ! response.respond_to?(:does_not_exist)
100
+ end
101
+
95
102
  def test_client_can_use_basic_auth
96
103
  client = GdsApi::JsonClient.new(basic_auth: {user: 'user', password: 'password'})
97
104
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.28
5
+ version: 0.0.29
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- hash: 2937289436236187170
163
+ hash: -2837227603408355889
164
164
  segments:
165
165
  - 0
166
166
  version: "0"
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
- hash: 2937289436236187170
172
+ hash: -2837227603408355889
173
173
  segments:
174
174
  - 0
175
175
  version: "0"