valicuit 0.2.4 → 0.2.5

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: a4b07e43942e1d7da0abca627bbf50a5987652d8
4
- data.tar.gz: 73ad9f9f4869a192ade3df731aa11ec75e3c540e
3
+ metadata.gz: d8c5499fefa188565405db823f16d164ba88dc54
4
+ data.tar.gz: 6baf4a33edb94a09457c8ac77b13ddee651166ac
5
5
  SHA512:
6
- metadata.gz: 35633eca4dcaef264b365f5aa53a3e6bd6bb2a7c1bcf2a88624eabaad8444f1d98699510cad4767ec434ff562bbfbede77ef5fff8e569e66c69c293c1d9f4eb9
7
- data.tar.gz: c9e027c67dc47abc8f57eccb77cb44839f78cc620caa5427182b1cdab123b3cb8b126409d7360d2e719782547bd94bfa8d68cd955b11ebf5ab2d18457b44d229
6
+ metadata.gz: 3d7e121aeaffd9561e1ec3dbdc7adeb5c50e99bc9062033e92a0712c151ed4ebaa9e0bcad2fcffc04900fdb6674fd5f17bd9adc8367f84c6780ca216c327da29
7
+ data.tar.gz: 319b488b056d7fe688fb4c73495589fa714594e4627f113a32a17620d8a63b0ed4dedb88656462817d3ee881a4ec2ba3c1abeab3dec31f60da3267f6516c5481
@@ -8,14 +8,6 @@ module ActiveModel
8
8
 
9
9
  # Here start the implementation of CUIT/CUIL validator
10
10
  class CuitValidator < ActiveModel::EachValidator
11
- CHECKS = [ :separator, :dni_compatible, :gender_compatible ].freeze
12
-
13
- # Hook that checks the options validity
14
- # for this validator
15
- def check_validity!
16
- invalid_options = options.keys - CHECKS
17
- raise ArgumentError, "#{invalid_options} are invalid CUIT/CUIL options. You can use only these: #{CHECKS.join(', ')}" unless invalid_options.empty?
18
- end
19
11
 
20
12
  def validate_each(record, attr_name, value)
21
13
  return if detect_any_failure_in :length, :digits, :dni_compatibility, :gender_compatibility, :v_digit,
@@ -1,3 +1,3 @@
1
1
  module Valicuit
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -5,31 +5,6 @@ RSpec.describe ActiveModel::Validations::CuitValidator do
5
5
  TestModel.reset_callbacks(:validate)
6
6
  end
7
7
 
8
- context '#check_validity!' do
9
- context 'when pass cuil option as validator' do
10
- it 'returns the validation options passed (therefore, all is well defined)' do
11
- expect(TestModel.validates :cuit, cuil: true).to eq(cuil: true)
12
- end
13
- end
14
- context 'when invalid options are passed' do
15
- it 'throws an ArgumentError' do
16
- expect do
17
- TestModel.validates :cuit, cuit: { separator: '/', wrong_param: true }
18
- end.to raise_error(ArgumentError)
19
- end
20
- end
21
- context 'when valid options are passed' do
22
- it 'returns the validation options passed (therefore, all is well defined)' do
23
- expect(TestModel.validates :cuit, cuit: { separator: '/' }).to eq(cuit: { separator: '/' })
24
- end
25
- end
26
- context 'when no options are passed (only true)' do
27
- it 'returns the validation options passed (therefore, all is well defined)' do
28
- expect(TestModel.validates :cuit, cuit: true).to eq(cuit: true)
29
- end
30
- end
31
- end
32
-
33
8
  context '#separate_cuit_groups' do
34
9
  context 'without provide separator' do
35
10
  let(:validator) { ActiveModel::Validations::CuitValidator.new attributes: { _: :_ } }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valicuit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lautaro Nahuel De León