correios_sigep 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +5 -0
- data/bin/rake +16 -0
- data/correios_sigep.gemspec +30 -0
- data/lib/correios_sigep.rb +38 -0
- data/lib/correios_sigep/builders/xml/authentication.rb +36 -0
- data/lib/correios_sigep/builders/xml/collect.rb +33 -0
- data/lib/correios_sigep/builders/xml/collect_objects.rb +25 -0
- data/lib/correios_sigep/builders/xml/product.rb +21 -0
- data/lib/correios_sigep/builders/xml/recipient.rb +30 -0
- data/lib/correios_sigep/builders/xml/request_collect_number.rb +16 -0
- data/lib/correios_sigep/builders/xml/sender.rb +34 -0
- data/lib/correios_sigep/configuration.rb +6 -0
- data/lib/correios_sigep/logistic_reverse/base_client.rb +32 -0
- data/lib/correios_sigep/logistic_reverse/request_collect_number.rb +53 -0
- data/lib/correios_sigep/models/collect.rb +27 -0
- data/lib/correios_sigep/models/correios_response_codes.rb +12 -0
- data/lib/correios_sigep/models/errors/collect_not_answered_for_the_zipcode.rb +8 -0
- data/lib/correios_sigep/models/errors/inexistent_zipcode.rb +8 -0
- data/lib/correios_sigep/models/errors/ticket_already_used.rb +8 -0
- data/lib/correios_sigep/models/errors/unavailable_house_collect.rb +8 -0
- data/lib/correios_sigep/models/errors/unavailable_service.rb +8 -0
- data/lib/correios_sigep/models/errors/unknown_error.rb +8 -0
- data/lib/correios_sigep/models/logistic_reverse.rb +23 -0
- data/lib/correios_sigep/models/object.rb +16 -0
- data/lib/correios_sigep/models/product.rb +14 -0
- data/lib/correios_sigep/models/recipient.rb +25 -0
- data/lib/correios_sigep/models/sender.rb +30 -0
- data/lib/correios_sigep/version.rb +3 -0
- data/spec/correios_sigep/builders/xml/request_collect_number_spec.rb +22 -0
- data/spec/correios_sigep/configuration_spec.rb +84 -0
- data/spec/correios_sigep/logistic_reverse/base_client_spec.rb +25 -0
- data/spec/correios_sigep/logistic_reverse/request_collect_number_spec.rb +101 -0
- data/spec/correios_sigep/models/collect_spec.rb +149 -0
- data/spec/correios_sigep/models/logistic_reverse_spec.rb +62 -0
- data/spec/correios_sigep/models/object_spec.rb +53 -0
- data/spec/correios_sigep/models/product_spec.rb +37 -0
- data/spec/correios_sigep/models/recipient_spec.rb +108 -0
- data/spec/correios_sigep/models/sender_spec.rb +141 -0
- data/spec/correios_sigep_spec.rb +41 -0
- data/spec/fixtures/correios/response_already_in_use.xml +14 -0
- data/spec/fixtures/correios/response_inexistent_zipcode.xml +14 -0
- data/spec/fixtures/correios/response_not_answered_for_zipcode.xml +14 -0
- data/spec/fixtures/correios/response_success.xml +27 -0
- data/spec/fixtures/correios/response_unavailable_house_collect.xml +14 -0
- data/spec/fixtures/correios/response_unavailable_service.xml +14 -0
- data/spec/fixtures/correios/response_unexpected.xml +14 -0
- data/spec/fixtures/correios/wsdl.xml +188 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/fixture_helper.rb +5 -0
- data/spec/support/logistic_reverse_helper.rb +15 -0
- metadata +240 -0
@@ -0,0 +1,149 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CorreiosSigep
|
4
|
+
module Models
|
5
|
+
describe Collect do
|
6
|
+
it { should respond_to :aditional_service }
|
7
|
+
it { should respond_to :ag }
|
8
|
+
it { should respond_to :ar }
|
9
|
+
it { should respond_to :card }
|
10
|
+
it { should respond_to :checklist }
|
11
|
+
it { should respond_to :client_id }
|
12
|
+
it { should respond_to :declared_value }
|
13
|
+
it { should respond_to :description }
|
14
|
+
it { should respond_to :number }
|
15
|
+
it { should respond_to :type }
|
16
|
+
it { should respond_to :product }
|
17
|
+
it { should respond_to :product_params }
|
18
|
+
it { should respond_to :sender }
|
19
|
+
it { should respond_to :sender_params }
|
20
|
+
it { should respond_to :objects }
|
21
|
+
|
22
|
+
describe '#initialize' do
|
23
|
+
let(:collect) { described_class.new params }
|
24
|
+
|
25
|
+
context 'with aditional service param' do
|
26
|
+
let(:params) { { aditional_service: '100.5' } }
|
27
|
+
it 'set aditional service value' do
|
28
|
+
expect(collect.aditional_service).to eq '100.5'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with ag param' do
|
33
|
+
let(:params) { { ag: '1' } }
|
34
|
+
it 'set ag value' do
|
35
|
+
expect(collect.ag).to eq '1'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with ar param' do
|
40
|
+
let(:params) { { ar: '2' } }
|
41
|
+
it 'set ar value' do
|
42
|
+
expect(collect.ar).to eq '2'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with card param' do
|
47
|
+
let(:params) { { card: '12345' } }
|
48
|
+
it 'set card value' do
|
49
|
+
expect(collect.card).to eq '12345'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'with checklist param' do
|
54
|
+
let(:params) { { checklist: 'CK' } }
|
55
|
+
it 'set checklist value' do
|
56
|
+
expect(collect.checklist).to eq 'CK'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'with client_id param' do
|
61
|
+
let(:params) { { client_id: '10965' } }
|
62
|
+
it 'set client_id value' do
|
63
|
+
expect(collect.client_id).to eq '10965'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'with declared value param' do
|
68
|
+
let(:params) { { declared_value: '200.5' } }
|
69
|
+
it 'set declared_value value' do
|
70
|
+
expect(collect.declared_value).to eq '200.5'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with description param' do
|
75
|
+
let(:params) { { description: 'description' } }
|
76
|
+
it 'set declared_value value' do
|
77
|
+
expect(collect.description).to eq 'description'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with number param' do
|
82
|
+
let(:params) { { number: 3 } }
|
83
|
+
it 'set number value' do
|
84
|
+
expect(collect.number).to eq 3
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'with type param' do
|
89
|
+
let(:params) { { type: 'type' } }
|
90
|
+
it 'set type value' do
|
91
|
+
expect(collect.type).to eq 'type'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
context 'with product param' do
|
97
|
+
let(:product) { double('product') }
|
98
|
+
let(:params) { { product: product } }
|
99
|
+
it 'set product as the object passed in param' do
|
100
|
+
expect(collect.product).to eq product
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'with product_params param' do
|
105
|
+
let(:params) { { product_params: { code: 'code' } } }
|
106
|
+
it 'set product as new object created with passed product_params' do
|
107
|
+
expect(collect.product).to be_a CorreiosSigep::Models::Product
|
108
|
+
expect(collect.product.code).to eq 'code'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'with sender param' do
|
113
|
+
let(:sender) { double('sender') }
|
114
|
+
let(:params) { { sender: sender } }
|
115
|
+
it 'set sender as the object passed in param' do
|
116
|
+
expect(collect.sender).to eq sender
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'with sender_params param' do
|
121
|
+
let(:params) { { sender_params: { name: 'sender name' } } }
|
122
|
+
it 'set sender as new object created with passed sender_params' do
|
123
|
+
expect(collect.sender).to be_a CorreiosSigep::Models::Sender
|
124
|
+
expect(collect.sender.name).to eq 'sender name'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'objects param' do
|
129
|
+
context 'present' do
|
130
|
+
let(:objects) { [ double('object1'), double('object2') ] }
|
131
|
+
let(:params) { { objects: objects } }
|
132
|
+
it 'return the objects passed in parameter' do
|
133
|
+
expect(collect.objects.size).to eq 2
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'not present' do
|
138
|
+
let(:params) { {} }
|
139
|
+
it 'returns an empty array' do
|
140
|
+
expect(collect.objects).to be_a(Array)
|
141
|
+
expect(collect.objects).to be_empty
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module CorreiosSigep
|
2
|
+
module Models
|
3
|
+
describe LogisticReverse do
|
4
|
+
it { should respond_to :collect }
|
5
|
+
it { should respond_to :recipient }
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
let(:logistic_reverse) { described_class.new params }
|
9
|
+
|
10
|
+
context 'collect params' do
|
11
|
+
context 'present' do
|
12
|
+
let(:collect) { double(:collect) }
|
13
|
+
let(:params) { { collect: collect } }
|
14
|
+
it 'set collect value as the same in the param' do
|
15
|
+
expect(logistic_reverse.collect).to eq collect
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'not present' do
|
20
|
+
let(:params) { {} }
|
21
|
+
it 'set collect as a new Collect model' do
|
22
|
+
expect(Models::Collect).to receive(:new).and_call_original
|
23
|
+
expect(logistic_reverse.collect).to be_a(Models::Collect)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'recipient param' do
|
30
|
+
context 'present' do
|
31
|
+
let(:recipient) { double(:recipient) }
|
32
|
+
let(:params) { { recipient: recipient } }
|
33
|
+
it 'set recipient value as the same in the param' do
|
34
|
+
expect(logistic_reverse.recipient).to eq recipient
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'not present' do
|
39
|
+
let(:params) { {} }
|
40
|
+
it 'set recipient as a new Recipient model' do
|
41
|
+
expect(Models::Recipient).to receive(:new).and_call_original
|
42
|
+
expect(logistic_reverse.recipient).to be_a(Models::Recipient)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#to_xml' do
|
50
|
+
let(:logistic_reverse) { described_class.new }
|
51
|
+
before :each do
|
52
|
+
seed_logistic_reverse(logistic_reverse)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'will generate the correct XMl of the logistic_reverse' do
|
56
|
+
expected_xml = "<?xml version=\"1.0\"?>\n<root>\n <destinatario>\n <nome>ESTABELECIMENT W*M</nome>\n <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n <numero>1400</numero>\n <complemento>G4</complemento>\n <bairro>FAZENDA ITAQUI</bairro>\n <referencia>REFERENCE</referencia>\n <cidade>BARUERI</cidade>\n <uf>SP</uf>\n <cep>06442130</cep>\n <ddd>11</ddd>\n <telefone>21683228</telefone>\n <email>teste@example.com</email>\n </destinatario>\n <coletas_solicitadas>\n <tipo>CA</tipo>\n <id_cliente>1405670</id_cliente>\n <valor_declarado>100.5</valor_declarado>\n <descricao>teste</descricao>\n <cklist>cklist</cklist>\n <numero>1</numero>\n <ag>1</ag>\n <cartao>1234</cartao>\n <servico_adicional>20.5</servico_adicional>\n <ar>2</ar>\n <remetente>\n <nome>JEFERSON VAZ DOS SANTOS</nome>\n <logradouro>RUA BLA BLA BLA</logradouro>\n <numero>666</numero>\n <complemento>APT 100</complemento>\n <bairro>PINHEIROS</bairro>\n <reference>REFERENCE</reference>\n <cidade>SÃO PAULO</cidade>\n <uf>SP</uf>\n <cep>05427020</cep>\n <ddd>16</ddd>\n <telefone>41606809</telefone>\n <email>jeff@example.com</email>\n <identificacao/>\n <ddd_celular/>\n <celular/>\n <sms/>\n </remetente>\n <produto>\n <codigo>code</codigo>\n <tipo>type</tipo>\n <qtd>3</qtd>\n </produto>\n <obj_col>\n <obj>\n <item>127078</item>\n <id>1405670</id>\n <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n <ship>ship</ship>\n <num>1</num>\n </obj>\n <obj>\n <item>277574</item>\n <id>1405670</id>\n <desc>Chip unico claro Pre pago</desc>\n <ship>ship</ship>\n <num>2</num>\n </obj>\n </obj_col>\n </coletas_solicitadas>\n</root>\n"
|
57
|
+
expect(logistic_reverse.to_xml).to eq expected_xml
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CorreiosSigep
|
4
|
+
module Models
|
5
|
+
describe Object do
|
6
|
+
it { should respond_to :description }
|
7
|
+
it { should respond_to :id }
|
8
|
+
it { should respond_to :item }
|
9
|
+
it { should respond_to :num }
|
10
|
+
it { should respond_to :ship }
|
11
|
+
|
12
|
+
describe '#initialize' do
|
13
|
+
let(:object) { described_class.new params }
|
14
|
+
|
15
|
+
context 'with description param' do
|
16
|
+
let(:params) { { description: 'description' } }
|
17
|
+
it 'set description value' do
|
18
|
+
expect(object.description).to eq 'description'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with id param' do
|
23
|
+
let(:params) { { id: 1234 } }
|
24
|
+
it 'set id value' do
|
25
|
+
expect(object.id).to eq 1234
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with item param' do
|
30
|
+
let(:params) { { item: 'Item' } }
|
31
|
+
it 'set item value' do
|
32
|
+
expect(object.item).to eq 'Item'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with num param' do
|
37
|
+
let(:params) { { num: 2 } }
|
38
|
+
it 'set num value' do
|
39
|
+
expect(object.num).to eq 2
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'with ship param' do
|
44
|
+
let(:params) { { ship: 'Ship' } }
|
45
|
+
it 'set ship value' do
|
46
|
+
expect(object.ship).to eq 'Ship'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CorreiosSigep
|
4
|
+
module Models
|
5
|
+
describe Product do
|
6
|
+
it { should respond_to :code }
|
7
|
+
it { should respond_to :type }
|
8
|
+
it { should respond_to :quantity }
|
9
|
+
|
10
|
+
describe '#initialize' do
|
11
|
+
let(:product) { described_class.new params }
|
12
|
+
|
13
|
+
context 'with code param' do
|
14
|
+
let(:params) { { code: 'code' } }
|
15
|
+
it 'set code value' do
|
16
|
+
expect(product.code).to eq 'code'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with type param' do
|
21
|
+
let(:params) { { type: 'type' } }
|
22
|
+
it 'set type value' do
|
23
|
+
expect(product.type).to eq 'type'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with quantity param' do
|
28
|
+
let(:params) { { quantity: 2 } }
|
29
|
+
it 'set quantity value' do
|
30
|
+
expect(product.quantity).to eq 2
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CorreiosSigep
|
4
|
+
module Models
|
5
|
+
describe Recipient do
|
6
|
+
it { should respond_to :address }
|
7
|
+
it { should respond_to :area_code }
|
8
|
+
it { should respond_to :city }
|
9
|
+
it { should respond_to :complement }
|
10
|
+
it { should respond_to :email }
|
11
|
+
it { should respond_to :name }
|
12
|
+
it { should respond_to :neighborhood }
|
13
|
+
it { should respond_to :number }
|
14
|
+
it { should respond_to :phone }
|
15
|
+
it { should respond_to :postal_code }
|
16
|
+
it { should respond_to :reference }
|
17
|
+
it { should respond_to :state }
|
18
|
+
|
19
|
+
describe '#initialize' do
|
20
|
+
let(:recipient) { described_class.new params }
|
21
|
+
context 'with address param' do
|
22
|
+
let(:params) { { address: 'address' } }
|
23
|
+
it 'set address value' do
|
24
|
+
expect(recipient.address).to eq 'address'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'with area code param' do
|
29
|
+
let(:params) { { area_code: 16 } }
|
30
|
+
it 'set area code value' do
|
31
|
+
expect(recipient.area_code).to eq 16
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'with city param' do
|
36
|
+
let(:params) { { city: 'ARARAQUARA' } }
|
37
|
+
it 'set city value' do
|
38
|
+
expect(recipient.city).to eq 'ARARAQUARA'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'with complement param' do
|
43
|
+
let(:params) { { complement: 'APTO 101' } }
|
44
|
+
it 'set complement value' do
|
45
|
+
expect(recipient.complement).to eq 'APTO 101'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'with email param' do
|
50
|
+
let(:params) { { email: 'test@example.com' } }
|
51
|
+
it 'set email value' do
|
52
|
+
expect(recipient.email).to eq 'test@example.com'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'with name param' do
|
57
|
+
let(:params) { { name: 'TEST' } }
|
58
|
+
it 'set name value' do
|
59
|
+
expect(recipient.name).to eq 'TEST'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'with neighborhood param' do
|
64
|
+
let(:params) { { neighborhood: 'NEIGHBORHOOD' } }
|
65
|
+
it 'set neighborhood value' do
|
66
|
+
expect(recipient.neighborhood).to eq 'NEIGHBORHOOD'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'with number param' do
|
71
|
+
let(:params) { { number: 125 } }
|
72
|
+
it 'set number value' do
|
73
|
+
expect(recipient.number).to eq 125
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'with phone param' do
|
78
|
+
let(:params) { { phone: '16123456789'} }
|
79
|
+
it 'set phone value' do
|
80
|
+
expect(recipient.phone).to eq '16123456789'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'with postal code param' do
|
85
|
+
let(:params) { { postal_code: '14840000'} }
|
86
|
+
it 'set postal_code value' do
|
87
|
+
expect(recipient.postal_code).to eq '14840000'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'with reference param' do
|
92
|
+
let(:params) { { reference: 'REFERENCE'} }
|
93
|
+
it 'set reference value' do
|
94
|
+
expect(recipient.reference).to eq 'REFERENCE'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'with state param' do
|
99
|
+
let(:params) { { state: 'SP'} }
|
100
|
+
it 'set state value' do
|
101
|
+
expect(recipient.state).to eq 'SP'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CorreiosSigep
|
4
|
+
module Models
|
5
|
+
describe Sender do
|
6
|
+
it { should respond_to :address }
|
7
|
+
it { should respond_to :area_code }
|
8
|
+
it { should respond_to :city }
|
9
|
+
it { should respond_to :complement }
|
10
|
+
it { should respond_to :email }
|
11
|
+
it { should respond_to :identification }
|
12
|
+
it { should respond_to :mobile_area_code }
|
13
|
+
it { should respond_to :mobile_phone }
|
14
|
+
it { should respond_to :name }
|
15
|
+
it { should respond_to :neighborhood }
|
16
|
+
it { should respond_to :number }
|
17
|
+
it { should respond_to :phone }
|
18
|
+
it { should respond_to :postal_code }
|
19
|
+
it { should respond_to :reference }
|
20
|
+
it { should respond_to :sms }
|
21
|
+
it { should respond_to :state }
|
22
|
+
|
23
|
+
describe '#initialize' do
|
24
|
+
let(:sender) { described_class.new params }
|
25
|
+
context 'with address param' do
|
26
|
+
let(:params) { { address: 'address' } }
|
27
|
+
it 'set address value' do
|
28
|
+
expect(sender.address).to eq 'address'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with area code param' do
|
33
|
+
let(:params) { { area_code: 16 } }
|
34
|
+
it 'set area code value' do
|
35
|
+
expect(sender.area_code).to eq 16
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with city param' do
|
40
|
+
let(:params) { { city: 'ARARAQUARA' } }
|
41
|
+
it 'set city value' do
|
42
|
+
expect(sender.city).to eq 'ARARAQUARA'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with complement param' do
|
47
|
+
let(:params) { { complement: 'APTO 101' } }
|
48
|
+
it 'set complement value' do
|
49
|
+
expect(sender.complement).to eq 'APTO 101'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'with email param' do
|
54
|
+
let(:params) { { email: 'test@example.com' } }
|
55
|
+
it 'set email value' do
|
56
|
+
expect(sender.email).to eq 'test@example.com'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'with identification param' do
|
61
|
+
let(:params) { { identification: 'IDENTIFICATION' } }
|
62
|
+
it 'set identification value' do
|
63
|
+
expect(sender.identification).to eq 'IDENTIFICATION'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'with mobile area code param' do
|
68
|
+
let(:params) { { mobile_area_code: 16 } }
|
69
|
+
it 'set mobile area code value' do
|
70
|
+
expect(sender.mobile_area_code).to eq 16
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
context 'with mobile phone code param' do
|
76
|
+
let(:params) { { mobile_phone: '16123456789' } }
|
77
|
+
it 'set mobile area code value' do
|
78
|
+
expect(sender.mobile_phone).to eq '16123456789'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'with name param' do
|
83
|
+
let(:params) { { name: 'TEST' } }
|
84
|
+
it 'set name value' do
|
85
|
+
expect(sender.name).to eq 'TEST'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'with neighborhood param' do
|
90
|
+
let(:params) { { neighborhood: 'NEIGHBORHOOD' } }
|
91
|
+
it 'set neighborhood value' do
|
92
|
+
expect(sender.neighborhood).to eq 'NEIGHBORHOOD'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'with number param' do
|
97
|
+
let(:params) { { number: 125 } }
|
98
|
+
it 'set number value' do
|
99
|
+
expect(sender.number).to eq 125
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'with phone param' do
|
104
|
+
let(:params) { { phone: '16123456789'} }
|
105
|
+
it 'set phone value' do
|
106
|
+
expect(sender.phone).to eq '16123456789'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'with postal code param' do
|
111
|
+
let(:params) { { postal_code: '14840000'} }
|
112
|
+
it 'set postal_code value' do
|
113
|
+
expect(sender.postal_code).to eq '14840000'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'with reference param' do
|
118
|
+
let(:params) { { reference: 'REFERENCE'} }
|
119
|
+
it 'set reference value' do
|
120
|
+
expect(sender.reference).to eq 'REFERENCE'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context 'with sms param' do
|
125
|
+
let(:params) { { sms: 'S'} }
|
126
|
+
it 'set sms value' do
|
127
|
+
expect(sender.sms).to eq 'S'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'with state param' do
|
132
|
+
let(:params) { { state: 'SP'} }
|
133
|
+
it 'set state value' do
|
134
|
+
expect(sender.state).to eq 'SP'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|