active_remote 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,8 @@ module ActiveRemote
|
|
4
4
|
# Returns a json representation of the whitelisted publishable attributes.
|
5
5
|
#
|
6
6
|
def as_json(options = {})
|
7
|
+
options ||= {}
|
8
|
+
|
7
9
|
default_options = { :only => _publishable_json_attributes, :methods => _publishable_json_methods }
|
8
10
|
default_options.merge!(options)
|
9
11
|
|
@@ -3,9 +3,16 @@ require 'spec_helper'
|
|
3
3
|
describe ActiveRemote::Serializers::JSON do
|
4
4
|
describe "#as_json" do
|
5
5
|
let(:attributes) { { :guid => 'foo', :name => 'bar' } }
|
6
|
+
let(:serializable_attributes) { { "tag" => attributes.stringify_keys } }
|
6
7
|
|
7
8
|
subject { Tag.new(attributes) }
|
8
9
|
|
10
|
+
context "when options are nil" do
|
11
|
+
it "substitutes an empty hash" do
|
12
|
+
subject.as_json(nil).should eq serializable_attributes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
9
16
|
it "accepts standard JSON options" do
|
10
17
|
subject.as_json(:root => false).should eq attributes.stringify_keys
|
11
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -221,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
segments:
|
223
223
|
- 0
|
224
|
-
hash: -
|
224
|
+
hash: -322020675846859839
|
225
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
226
|
none: false
|
227
227
|
requirements:
|
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
230
|
version: '0'
|
231
231
|
segments:
|
232
232
|
- 0
|
233
|
-
hash: -
|
233
|
+
hash: -322020675846859839
|
234
234
|
requirements: []
|
235
235
|
rubyforge_project:
|
236
236
|
rubygems_version: 1.8.24
|