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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cecc3ef6f720b2c99f7a96c32b90d8354ca441d6d97af238d4186602d1dcf5e5
4
- data.tar.gz: ea7a54c1f4e8fdad398ad5403f84a8e13c706a1a5792b0188885857b1c8d0731
3
+ metadata.gz: 7956e474a01a96f138b7dd2e926d77ecd28df3f9f9d3da82f924714c08a60a5e
4
+ data.tar.gz: f43d74f9eaf88f5bb13ad669cf1e9bc8583f9f4e70708878062cb9565596ec17
5
5
  SHA512:
6
- metadata.gz: e99acf68431e0bff2ab8ad0f374bb06371b3bad7cfc0a70276677ad61577555759a5e81da961c68318bae3f7f3e5871c3e8a224d0123e564f570785df5d820fb
7
- data.tar.gz: 29d9667e29a094876fbdb4cbd1253e42de6099bcf2b62d795397840bea23a6bc5ef334cec74e8b1f1468b793905afec0e2193220459e9b3ed6a0a51126dc10aa
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
@@ -1,3 +1,3 @@
1
1
  module Lev
2
- VERSION = "9.0.2"
2
+ VERSION = "9.0.3"
3
3
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe 'Better active model errors' do
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.2
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-08-02 00:00:00.000000000 Z
11
+ date: 2019-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel