json_schema_tools 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -99,7 +99,7 @@ module SchemaTools
|
|
99
99
|
obj_val = obj.send(match[0]) if obj.respond_to?(match[0])
|
100
100
|
replaces << ["{#{match[0]}}", obj_val] if obj_val
|
101
101
|
end
|
102
|
-
replaces.each {|r| href.gsub!(r[0], r[1])}
|
102
|
+
replaces.each {|r| href.gsub!(r[0], "#{r[1]}")}
|
103
103
|
href = "#{opts[:base_url]}/#{href}" if opts[:base_url]
|
104
104
|
|
105
105
|
links << { 'rel' => link['rel'],
|
data/lib/schema_tools/version.rb
CHANGED
@@ -179,8 +179,9 @@ describe SchemaTools::Hash do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it 'should replace placeholders' do
|
182
|
+
client.id = 123
|
182
183
|
hash = SchemaTools::Hash.from_schema(client, base_url: 'http://json-hell.com')
|
183
|
-
hash['links'].last['href'].should == 'http://json-hell.com/clients/
|
184
|
+
hash['links'].last['href'].should == 'http://json-hell.com/clients/123/Peter'
|
184
185
|
end
|
185
186
|
|
186
187
|
end
|