active_remote 5.0.1 → 5.1.0.rc1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1d90749f5dc8c010ca745ccf81c9167918666d334121659fcc0139fd2cbf0d8
|
4
|
+
data.tar.gz: 1fd7090e3d4f5e2c7c5230dcb5cbdc14be2dde8e11741081a77c60deb0c5088b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb5c5ec4d8f498e45db07b2e68af30542c76dde3c14008cebb5a70861c0768730e494af69d091026c83ad0449cc940a8f0f7c09b9e81c177a6afef61e79dd60
|
7
|
+
data.tar.gz: 17f944f3c0a44436bd0ab0d24d712bc1b420e5b1f90a2ea1d5bae8672320e4d3fea28efc5e86fcd24635198302c348a3a958cae9c068bdc28601ba12a5f982f2
|
data/active_remote.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
##
|
21
21
|
# Dependencies
|
22
22
|
#
|
23
|
-
s.add_dependency "activemodel", "
|
24
|
-
s.add_dependency "activesupport", "
|
23
|
+
s.add_dependency "activemodel", "~> 5.1.0"
|
24
|
+
s.add_dependency "activesupport", "~> 5.1.0"
|
25
25
|
s.add_dependency "protobuf", ">= 3.0"
|
26
26
|
|
27
27
|
##
|
data/lib/active_remote/errors.rb
CHANGED
@@ -43,16 +43,6 @@ module ActiveRemote
|
|
43
43
|
# Raised by ActiveRemove::Base.save! and ActiveRemote::Base.create! methods
|
44
44
|
# when remote record cannot be saved because it is invalid.
|
45
45
|
class RemoteRecordNotSaved < ActiveRemoteError
|
46
|
-
attr_reader :record
|
47
|
-
|
48
|
-
def initialize(message_or_record = nil)
|
49
|
-
message = message_or_record
|
50
|
-
if message_or_record.is_a?(::ActiveRemote::Base)
|
51
|
-
@record = message_or_record
|
52
|
-
message = @record.errors.full_messages.join(", ")
|
53
|
-
end
|
54
|
-
super(message)
|
55
|
-
end
|
56
46
|
end
|
57
47
|
|
58
48
|
class UnknownAttributeError < ActiveRemoteError
|
@@ -198,7 +198,7 @@ module ActiveRemote
|
|
198
198
|
# Also runs any before/after save callbacks that are defined.
|
199
199
|
#
|
200
200
|
def save!(*args)
|
201
|
-
save(*args) ||
|
201
|
+
save(*args) || raise(RemoteRecordNotSaved)
|
202
202
|
end
|
203
203
|
|
204
204
|
# Returns true if the record doesn't have errors; otherwise, returns false.
|
@@ -314,16 +314,9 @@ describe ::ActiveRemote::Persistence do
|
|
314
314
|
end
|
315
315
|
|
316
316
|
context "when the record is not saved" do
|
317
|
-
let(:errors) {
|
318
|
-
[Generic::Error.new(:field => "name", :message => "Error one!"),
|
319
|
-
Generic::Error.new(:field => "name", :message => "Error two!")]
|
320
|
-
}
|
321
|
-
let(:response) { Generic::Remote::Tag.new(:errors => errors) }
|
322
|
-
before { allow(rpc).to receive(:execute).and_return(response) }
|
323
|
-
|
324
317
|
it "raises an exception" do
|
325
|
-
|
326
|
-
|
318
|
+
allow(subject).to receive(:save).and_return(false)
|
319
|
+
expect { subject.save! }.to raise_error(ActiveRemote::RemoteRecordNotSaved)
|
327
320
|
end
|
328
321
|
end
|
329
322
|
end
|
metadata
CHANGED
@@ -1,49 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hutchison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.0'
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 5.1.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '5.0'
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 5.1.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: activesupport
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - "
|
31
|
+
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
33
|
+
version: 5.1.0
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- - "
|
38
|
+
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
version: 5.1.0
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: protobuf
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,7 +228,6 @@ files:
|
|
234
228
|
- spec/lib/active_remote/base_spec.rb
|
235
229
|
- spec/lib/active_remote/dirty_spec.rb
|
236
230
|
- spec/lib/active_remote/dsl_spec.rb
|
237
|
-
- spec/lib/active_remote/errors_spec.rb
|
238
231
|
- spec/lib/active_remote/integration_spec.rb
|
239
232
|
- spec/lib/active_remote/persistence_spec.rb
|
240
233
|
- spec/lib/active_remote/primary_key_spec.rb
|
@@ -284,12 +277,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
284
277
|
version: '0'
|
285
278
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
279
|
requirements:
|
287
|
-
- - "
|
280
|
+
- - ">"
|
288
281
|
- !ruby/object:Gem::Version
|
289
|
-
version:
|
282
|
+
version: 1.3.1
|
290
283
|
requirements: []
|
291
|
-
|
292
|
-
rubygems_version: 2.7.6
|
284
|
+
rubygems_version: 3.0.2
|
293
285
|
signing_key:
|
294
286
|
specification_version: 4
|
295
287
|
summary: Active Record for your platform
|
@@ -299,7 +291,6 @@ test_files:
|
|
299
291
|
- spec/lib/active_remote/base_spec.rb
|
300
292
|
- spec/lib/active_remote/dirty_spec.rb
|
301
293
|
- spec/lib/active_remote/dsl_spec.rb
|
302
|
-
- spec/lib/active_remote/errors_spec.rb
|
303
294
|
- spec/lib/active_remote/integration_spec.rb
|
304
295
|
- spec/lib/active_remote/persistence_spec.rb
|
305
296
|
- spec/lib/active_remote/primary_key_spec.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ::ActiveRemote::RemoteRecordNotSaved do
|
4
|
-
let(:record) { ::Tag.new }
|
5
|
-
|
6
|
-
before do
|
7
|
-
record.errors[:base] << "Some error one!"
|
8
|
-
record.errors[:base] << "Some error two!"
|
9
|
-
end
|
10
|
-
|
11
|
-
context "when an active remote record is used" do
|
12
|
-
it "uses embedded errors in message" do
|
13
|
-
expect { fail(::ActiveRemote::RemoteRecordNotSaved, record) }
|
14
|
-
.to raise_error(ActiveRemote::RemoteRecordNotSaved, "Some error one!, Some error two!")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "when a string is used" do
|
19
|
-
it "uses the string in the error message" do
|
20
|
-
expect { fail(::ActiveRemote::RemoteRecordNotSaved, "something bad happened") }
|
21
|
-
.to raise_error(ActiveRemote::RemoteRecordNotSaved, "something bad happened")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when no message is used" do
|
26
|
-
it "raises the error" do
|
27
|
-
expect { raise(::ActiveRemote::RemoteRecordNotSaved) }
|
28
|
-
.to raise_error(ActiveRemote::RemoteRecordNotSaved)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|