roar 0.12.6 → 0.12.7

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: db7cda8e7774438e2c12828c256a93501719b176
4
- data.tar.gz: 2f61956f6ea000358e40713d958af2e8c58219a6
3
+ metadata.gz: f83dc6d5009e6fee594a68ec001885cd1fe34633
4
+ data.tar.gz: 5e82fb1a251205d78898f1609d1fa992e8c0dbb5
5
5
  SHA512:
6
- metadata.gz: 5b04289bf9e1b07ff13ffe52dea647c0c82b6154d49d5ac2e2b657498a031bf24574751a546ecce8dd76fb9511a3ded0eb2f3131eb3c1e16306849f115335da2
7
- data.tar.gz: 28a0c35f6240627b1fe1b5924e2f7e8d8ca27761c4f56a12138fabd8768394dfe3ea63517892bdbb9f83f36ee5222c003d3d16a00cfc63e6ab1af3c03c87cad7
6
+ metadata.gz: ef5c2c6fe33df422ee672250b5bd482aaa56bace33debdd1ae842ad2878e3a8cbb5a85da35308653952f3bf83734f98520a187b2e3751c06bf1586ad5d613e21
7
+ data.tar.gz: e8e31d4672aad7bd3470c49e640cae28aebfaa3541b4ab14ea25f2bb9b29084a84f2c4d817a3da9cee1dd2b01deb991b45713244d973ae50207b53844e777bdf
data/CHANGES.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.12.7
2
+
3
+ * Bug fix where hypermedia links were wrong when invoking serialization multiple times on the same instance.
4
+
1
5
  # 0.12.6
2
6
 
3
7
  * Remove deprecations (most of 'em) from representable-1.8. Sorry for that.
@@ -94,7 +94,7 @@ module Roar
94
94
  end
95
95
 
96
96
  def prepare_link_for(href, options)
97
- options.merge! href.is_a?(Hash) ? href : {:href => href}
97
+ options = options.merge(href.is_a?(Hash) ? href : {:href => href})
98
98
  Hyperlink.new(options)
99
99
  end
100
100
 
data/lib/roar/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Roar
2
- VERSION = "0.12.6"
2
+ VERSION = "0.12.7"
3
3
  end
@@ -107,10 +107,20 @@ class HypermediaTest < MiniTest::Spec
107
107
  describe "returning option hash from block" do
108
108
  representer_for do
109
109
  link(:self) do {:href => "//self", :type => "image/jpg"} end
110
+ link(:other) do |params|
111
+ hash = { :href => "//other" }
112
+ hash.merge!(:type => 'image/jpg') if params[:type]
113
+ hash
114
+ end
110
115
  end
111
116
 
112
117
  it "is rendered as link attributes" do
113
- subject.to_json.must_equal "{\"links\":[{\"rel\":\"self\",\"href\":\"//self\",\"type\":\"image/jpg\"}]}"
118
+ subject.to_json.must_equal "{\"links\":[{\"rel\":\"self\",\"href\":\"//self\",\"type\":\"image/jpg\"},{\"rel\":\"other\",\"href\":\"//other\"}]}"
119
+ end
120
+
121
+ it "is rendered according to context" do
122
+ subject.to_json(type: true).must_equal "{\"links\":[{\"rel\":\"self\",\"href\":\"//self\",\"type\":\"image/jpg\"},{\"rel\":\"other\",\"href\":\"//other\",\"type\":\"image/jpg\"}]}"
123
+ subject.to_json.must_equal "{\"links\":[{\"rel\":\"self\",\"href\":\"//self\",\"type\":\"image/jpg\"},{\"rel\":\"other\",\"href\":\"//other\"}]}"
114
124
  end
115
125
  end
116
126
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: representable