bra_documents 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/expectations'
4
+
5
+ RSpec::Matchers.define :a_formatted_cpf do
6
+ match do |cpf|
7
+ formatted_cpf_pattern = /\A(\d{3}\.\d{3}\.\d{3})-(\d{2})\z/
8
+
9
+ formatted_cpf_pattern.match?(cpf.to_s)
10
+ end
11
+
12
+ failure_message do |cpf|
13
+ "Was expected `#{cpf.inspect}` to be a Brazilian CPF document number but it isn't.\n"\
14
+ "A CPF has the following format XXX.XXX.XXX-XX where X are numbers from 0 to 9.\n"
15
+ end
16
+ end
17
+
18
+ RSpec::Matchers.define :a_raw_cpf do
19
+ match do |cpf|
20
+ raw_cpf_pattern = /\A\d{11}\z/
21
+
22
+ raw_cpf_pattern.match?(cpf.to_s)
23
+ end
24
+
25
+ failure_message do |cpf|
26
+ "Was expected `#{cpf.inspect}` to be a raw Brazilian CPF document number but it isn't.\n"\
27
+ "A raw CPF has the following format XXXXXXXXXXX where X are numbers from 0 to 9.\n"
28
+ end
29
+ end
30
+
31
+ RSpec::Matchers.alias_matcher :be_a_formatted_cpf, :a_formatted_cpf
32
+ RSpec::Matchers.alias_matcher :be_a_raw_cpf, :a_raw_cpf
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BraDocuments
4
+ VERSION = '1.0.0'
5
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bra_documents
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Bruno Vicenzo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry-nav
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Here we are able to generate CPNJ and CPF documents, only numbers or
70
+ formatted.
71
+ email:
72
+ - bruno@alumni.usp.br
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - CHANGELOG.md
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE
84
+ - LICENSE.txt
85
+ - README.md
86
+ - Rakefile
87
+ - bin/console
88
+ - bin/setup
89
+ - bra_documents.gemspec
90
+ - lib/bra_documents.rb
91
+ - lib/bra_documents/cnpj_generator.rb
92
+ - lib/bra_documents/cpf_generator.rb
93
+ - lib/bra_documents/formatter.rb
94
+ - lib/bra_documents/national_register_base.rb
95
+ - lib/bra_documents/testing/rspec.rb
96
+ - lib/bra_documents/testing/rspec/matchers/cnpj_matcher.rb
97
+ - lib/bra_documents/testing/rspec/matchers/cpf_matcher.rb
98
+ - lib/bra_documents/version.rb
99
+ homepage: https://github.com/bvicenzo/bra_documents
100
+ licenses:
101
+ - MIT
102
+ metadata:
103
+ allowed_push_host: https://rubygems.org/
104
+ homepage_uri: https://github.com/bvicenzo/bra_documents
105
+ source_code_uri: https://github.com/bvicenzo/bra_documents
106
+ changelog_uri: https://github.com/bvicenzo/bra_documents/blob/master/CHANGELOG.md
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 2.3.0
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubygems_version: 3.1.4
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: A implementation for generating Brazilian CPF and CNPJ document numbers.
126
+ test_files: []