flexirest 1.3.4 → 1.3.5

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: 5b8f5b60cec3d61fa565609de5a87d2dbcb93478
4
- data.tar.gz: 0d500e6c2e4513ddd78c540037b64e7153d1c434
3
+ metadata.gz: 72686cd331c6be616ddc6595d627fa5e19b12fbb
4
+ data.tar.gz: d259d2ffee7a14396924bfd8d14b65ec51d2022a
5
5
  SHA512:
6
- metadata.gz: ce782dd60d2338981917cb27bba2d536cb45f4aa7650966bbca3bccd2facd9b7712a435a2ed30572eac985fd5d7b5deb34d43d7cffb87e376cddc70d07d5a9dc
7
- data.tar.gz: 4288825a7cfc6a84e2950a06e3388d7417d6d4b022f9fcdd65e5945fc9b8158307ff4cfe8f820f7667a10572fb7c081f67be71f413c37572818ab4e9be598a6e
6
+ metadata.gz: 942d3cc68e549d9d916cf1ef22528995f6852b904501dca4a2e3dd68457acc820408d86ed8d9e14e152f2b40a78deb5835f5e4cc351f80572228fa8bdb00d2fc
7
+ data.tar.gz: 7f517c2b407b895cdf8d3c2660079cc9781ee50c968843bdc1de77a49abcf2094aec68258a7dae042b9a99c04f50c16fb23cfab6c3f075c57e5113c0999737e5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.5
4
+
5
+ Bugfix:
6
+
7
+ - Deeply nested has_many relationships weren't working (thanks to Lewis Buckley for the bug report, spec and fix).
8
+
3
9
  ## 1.3.4
4
10
 
5
11
  Features:
@@ -45,6 +45,10 @@ module Flexirest
45
45
  @items[key]
46
46
  end
47
47
 
48
+ def []=(key, value)
49
+ @items[key] = value
50
+ end
51
+
48
52
  def shuffle
49
53
  @items = @items.shuffle
50
54
  self
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.3.4"
2
+ VERSION = "1.3.5"
3
3
  end
@@ -16,6 +16,19 @@ class AssociationExampleBase < Flexirest::Base
16
16
  has_one :association_example_other
17
17
  end
18
18
 
19
+ class DeepNestedHasManyChildExample < Flexirest::Base
20
+ end
21
+
22
+ class DeepNestedHasManyTopExample < Flexirest::Base
23
+ has_many :entries, DeepNestedHasManyChildExample
24
+ end
25
+
26
+ class DeepNestedHasManyExample < Flexirest::Base
27
+ has_many :results, DeepNestedHasManyTopExample
28
+ hash = { results: [ { entries: [ { items: [ "item one", "item two" ] } ] }, { entries: [ { items: [ "item three", "item four" ] } ] } ] }
29
+ get :find, "/iterate", fake: hash.to_json
30
+ end
31
+
19
32
  describe "Has Many Associations" do
20
33
  let(:subject) {AssociationExampleBase.new}
21
34
 
@@ -54,6 +67,11 @@ describe "Has Many Associations" do
54
67
  subject.others = [{nested: [{test: "foo"}]}]
55
68
  expect(subject.others.first.nested.first.test).to eq("foo")
56
69
  end
70
+
71
+ it "should correctly work with deep nested associations" do
72
+ finder = DeepNestedHasManyExample.find
73
+ expect(finder.results.count).to eq(2)
74
+ end
57
75
  end
58
76
 
59
77
  describe "Has One Associations" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler