valicuit 0.2.3 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24b741a2e8ab39b34b05604b34fc3c0bf7a64f9b
4
- data.tar.gz: cc5582902091c831fdd7d0091c13fd58292c2a3f
3
+ metadata.gz: a4b07e43942e1d7da0abca627bbf50a5987652d8
4
+ data.tar.gz: 73ad9f9f4869a192ade3df731aa11ec75e3c540e
5
5
  SHA512:
6
- metadata.gz: dcd32f985e9b1b235ba76bb0e59c7773d36b2375b95f475eb007ca9fe1cbdcb547ca357b09bc94c102e5087c0a471fb8b758efe9759d4fc19f351e4edb6b7423
7
- data.tar.gz: aba2719b8532e2bd591cfd8f564ac5f2065f1fbd32e4b320c8b4d2a87ab899852b799f3d8ba999632cc22fffeba9791604eaaf0bdfbfb5c81f1e4d0ffb10fcf3
6
+ metadata.gz: 35633eca4dcaef264b365f5aa53a3e6bd6bb2a7c1bcf2a88624eabaad8444f1d98699510cad4767ec434ff562bbfbede77ef5fff8e569e66c69c293c1d9f4eb9
7
+ data.tar.gz: c9e027c67dc47abc8f57eccb77cb44839f78cc620caa5427182b1cdab123b3cb8b126409d7360d2e719782547bd94bfa8d68cd955b11ebf5ab2d18457b44d229
@@ -89,6 +89,7 @@ module ActiveModel
89
89
 
90
90
  def separate_cuit_groups(cuit)
91
91
  separator = options[:separator]
92
+ cuit = cuit.to_s
92
93
  if separator
93
94
  cuit.split(separator).first 3
94
95
  else
@@ -1,3 +1,3 @@
1
1
  module Valicuit
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -54,6 +54,12 @@ RSpec.describe ActiveModel::Validations::CuitValidator do
54
54
  expect(group).to be_an_instance_of String
55
55
  end
56
56
  end
57
+
58
+ it 'gracefully handles nil input values' do
59
+ validator.send(:separate_cuit_groups, nil).each do |group|
60
+ expect(group).to be_an_instance_of String
61
+ end
62
+ end
57
63
  end
58
64
  context 'providing separator' do
59
65
  let(:validator) do
@@ -112,6 +118,9 @@ RSpec.describe ActiveModel::Validations::CuitValidator do
112
118
  it 'must return false' do
113
119
  expect(TestModel.new(cuit: '301110')).to be_invalid
114
120
  end
121
+ it 'must return false for a nil value' do
122
+ expect(TestModel.new(cuit: nil)).to be_invalid
123
+ end
115
124
  it 'must leave a specific message over :cuit in #errors array' do
116
125
  record = TestModel.new(cuit: '301110')
117
126
  record.valid?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valicuit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lautaro Nahuel De León
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel