loquor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8334f8eab469a6bcdc5b6172197c66186bc917c8
4
- data.tar.gz: ba0235139b198343316b545a12312e07346e7965
3
+ metadata.gz: 0d5223911307f2a072de37742e93f4c08a67592a
4
+ data.tar.gz: af4b9f1dc22ea1affdcb1b4d7df4813fdd9c42fa
5
5
  SHA512:
6
- metadata.gz: bc89065f697c802a9f5f207a9f369cb5194401b8210c46975b6e78cd94c201afa963511b96abeccf105ea9700de7cd6948b17a22a45097360a0db2b243eb39a1
7
- data.tar.gz: 7084fabea27d2ed79703bf1cb9dbbc317883eecb4bf8b1651163e79820dd0ac1f1fe629455b173116da32984ee289e5fd3988e75b396538c87450f87b3ee2a97
6
+ metadata.gz: 3a645d10cd0c71c6cc2e4495e9faef127a7b17659b227fe54f92bfa14faeaf808d82af1f098920d50a417726ec103d5f455b3064c50c732d68ab55b9a7541629
7
+ data.tar.gz: 05207e53a713ec9892e96f960fa47572f68e3114c1b1ff57c0a5cdd8df98551371d25f6bee838269ac6fd0031c7a4d18cffb4bea6d24058817782cd76e820fad
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.1.0 / 2014-01-24
2
+ * [FEATURE] Add respond_to support for object hashes
3
+
1
4
  # 1.0.0 / 2014-01-22
2
5
  * [BUGFIX] Fix issue wth mock not responding to update correctly
3
6
 
@@ -36,6 +36,11 @@ module Loquor
36
36
  end
37
37
  end
38
38
 
39
+ def respond_to?(key)
40
+ return true if super
41
+ @hash.has_key?(key)
42
+ end
43
+
39
44
  private
40
45
 
41
46
  def fetch_indescriminately(name, *args)
@@ -11,6 +11,11 @@ module Loquor
11
11
  raise NameError.new("undefined local variable or method '#{name}' for #{self.class.name}")
12
12
  end
13
13
 
14
+ def respond_to?(name)
15
+ return true if super
16
+ @data.respond_to?(name)
17
+ end
18
+
14
19
  def self.path=(path)
15
20
  @path = path
16
21
  end
@@ -1,3 +1,3 @@
1
1
  module Loquor
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -22,6 +22,21 @@ module Loquor
22
22
  assert_equal "bar", representation[1]
23
23
  end
24
24
 
25
+ def test_respond_to_still_proxies_to_super
26
+ representation = ObjectHash.new({})
27
+ assert_equal true, representation.respond_to?(:to_s)
28
+ end
29
+
30
+ def test_respond_to_still_returns_false_for_non_existant_keys
31
+ representation = ObjectHash.new({})
32
+ assert_equal false, representation.respond_to?(:dog)
33
+ end
34
+
35
+ def test_respond_to_knows_about_hash_keys
36
+ representation = ObjectHash.new({foo: "bar"})
37
+ assert_equal true, representation.respond_to?(:foo)
38
+ end
39
+
25
40
  def test_hash_keys_are_accessible_via_methods
26
41
  representation = ObjectHash.new({foo: "bar"})
27
42
  assert_equal "bar", representation.foo
@@ -6,6 +6,21 @@ module Loquor
6
6
  self.path = "/foobar"
7
7
  end
8
8
 
9
+ def test_respond_to_still_proxies_to_super
10
+ foobar = Foobar.new({})
11
+ assert_equal true, foobar.respond_to?(:to_s)
12
+ end
13
+
14
+ def test_respond_to_still_returns_false_for_non_existant_keys
15
+ foobar = Foobar.new({})
16
+ assert_equal false, foobar.respond_to?(:dog)
17
+ end
18
+
19
+ def test_respond_to_should_proxy_to_data
20
+ foobar = Foobar.new({foo: 'bar'})
21
+ assert foobar.respond_to?(:foo)
22
+ end
23
+
9
24
  def test_find_should_get_correct_path_with_simple_path
10
25
  id = 8
11
26
  Loquor.expects(:get).with("/foobar/#{id}")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loquor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filum
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.2.1
177
+ rubygems_version: 2.1.9
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: This library dispatches requests to Meducation
@@ -193,3 +193,4 @@ test_files:
193
193
  - test/resource_mock_test.rb
194
194
  - test/resource_test.rb
195
195
  - test/test_helper.rb
196
+ has_rdoc: