protobuf-activerecord 2.1.0.beta3 → 2.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,7 @@ module Protoable
|
|
34
34
|
|
35
35
|
# :nodoc:
|
36
36
|
def assign_attributes(attributes, options = {})
|
37
|
-
attributes = attributes_from_proto(
|
37
|
+
attributes = attributes_from_proto(attributes) if attributes.is_a?(::Protobuf::Message)
|
38
38
|
|
39
39
|
super(attributes, options)
|
40
40
|
end
|
@@ -30,6 +30,20 @@ describe Protoable::Persistence do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
describe "#assign_attributes" do
|
34
|
+
let(:user) { ::User.new }
|
35
|
+
|
36
|
+
it "accepts a protobuf message" do
|
37
|
+
user.assign_attributes(proto)
|
38
|
+
user.changed?.should be_true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "accepts a hash" do
|
42
|
+
user.assign_attributes(user_attributes)
|
43
|
+
user.changed?.should be_true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
33
47
|
describe "#update_attributes" do
|
34
48
|
it "accepts a protobuf message" do
|
35
49
|
User.any_instance.should_receive(:save)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.
|
4
|
+
version: 2.1.0.rc1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -256,7 +256,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
256
256
|
version: '0'
|
257
257
|
segments:
|
258
258
|
- 0
|
259
|
-
hash: -
|
259
|
+
hash: -2527943070011041426
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
261
|
none: false
|
262
262
|
requirements:
|