lev 9.0.2 → 9.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lev/better_active_model_errors.rb +8 -0
- data/lib/lev/version.rb +1 -1
- data/spec/better_active_model_errors_spec.rb +13 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7956e474a01a96f138b7dd2e926d77ecd28df3f9f9d3da82f924714c08a60a5e
|
4
|
+
data.tar.gz: f43d74f9eaf88f5bb13ad669cf1e9bc8583f9f4e70708878062cb9565596ec17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ab5a852630a17de13e57cc038a90409e3c472013eac10206c865938df076b5b19111a0a979aace04e4d4cdb7c134c1f91945fcecd862bbccea193d72ac4341
|
7
|
+
data.tar.gz: fc864a9f83b3c3c7417f8b1e508fa5288ecdef4ce8cd66d5dae6cb21088db9bf41798c2836e8506893e618e2ede1803d0487ba5ac3b4f648b993e2f0d1646553
|
@@ -83,6 +83,14 @@ module Lev
|
|
83
83
|
@messages = ActiveSupport::OrderedHash.new
|
84
84
|
end
|
85
85
|
|
86
|
+
# copy & details are needed to match `ActiveModel::Errors` interface
|
87
|
+
def copy!(other)
|
88
|
+
initialize_dup(other)
|
89
|
+
end
|
90
|
+
def details
|
91
|
+
{}
|
92
|
+
end
|
93
|
+
|
86
94
|
def initialize_dup(other)
|
87
95
|
@types = other.types.dup
|
88
96
|
@messages = other.messages.dup
|
data/lib/lev/version.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe '
|
4
|
-
|
3
|
+
RSpec.describe 'BetterActiveModelErrors' do
|
5
4
|
class DummyModel
|
6
5
|
def self.human_attribute_name(attr, default='')
|
7
6
|
return attr.capitalize
|
@@ -22,4 +21,16 @@ RSpec.describe 'Better active model errors' do
|
|
22
21
|
expect(errors.include?('crash')).to be true
|
23
22
|
end
|
24
23
|
|
24
|
+
it 'duplicates when copy called' do
|
25
|
+
model = OpenStruct.new
|
26
|
+
|
27
|
+
error = Lev::BetterActiveModelErrors.new(model)
|
28
|
+
error.set(:code, 'error')
|
29
|
+
expect(error.get(:code)).to eq 'error'
|
30
|
+
|
31
|
+
other = Lev::BetterActiveModelErrors.new(model)
|
32
|
+
other.set(:code, 'warning')
|
33
|
+
error.copy!(other)
|
34
|
+
expect(error.get(:code)).to eq 'warning'
|
35
|
+
end
|
25
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0.
|
4
|
+
version: 9.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|