addressfinder 1.9.1 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,74 +0,0 @@
1
- require 'spec_helper'
2
- require 'fileutils'
3
-
4
- RSpec.describe AddressFinder do
5
- before do
6
- AddressFinder.configure do |af|
7
- af.api_key = 'XXX'
8
- af.api_secret = 'YYY'
9
- af.default_country = 'nz'
10
- af.timeout = 5
11
- af.retries = 5
12
- end
13
- end
14
-
15
- describe '#verification with verification_version configured to "v2"' do
16
- before do
17
- AddressFinder.configuration.verification_version = "v2"
18
- end
19
-
20
- after do
21
- AddressFinder.configuration.verification_version = nil # set back to nil after
22
- end
23
-
24
- subject(:verification){ AddressFinder.verification(args) }
25
-
26
- context "with country set to nz" do
27
- let(:args){ {country: "nz", q: "12 high street sydney"} }
28
- it "calls the old class" do
29
- expect(AddressFinder::Verification).to receive_message_chain(:new, :perform, :result)
30
- subject
31
- end
32
-
33
- it "safely passes arguments through" do
34
- stub_request(:get, Addressable::Template.new("https://api.addressfinder.io/api/nz/address/verification{?args*}")).to_return(:status => 200, :body => "{}", :headers => {})
35
- subject
36
- end
37
- end
38
-
39
- context "with country set to au" do
40
- let(:args){ {country: "au", q: "12 high street sydney"} }
41
- it "calls the v2::Au class" do
42
- expect(AddressFinder::V2::Au::Verification).to receive_message_chain(:new, :perform, :result)
43
- subject
44
- end
45
-
46
- it "safely passes arguments through" do
47
- stub_request(:get, Addressable::Template.new("https://api.addressfinder.io/api/au/address/v2/verification{?args*}")).to_return(:status => 200, :body => "{}", :headers => {})
48
- subject
49
- end
50
- end
51
- end
52
-
53
- describe '#verification with verification_version not configured' do
54
- subject(:verification){ AddressFinder.verification(args) }
55
-
56
- context "with country set to nz" do
57
- let(:args){ {country: "nz", q: "12 high street sydney"} }
58
-
59
- it "calls the old class" do
60
- expect(AddressFinder::Verification).to receive_message_chain(:new, :perform, :result)
61
- subject
62
- end
63
- end
64
-
65
- context "with country set to au" do
66
- let(:args){ {country: "au", q: "12 high street sydney"} }
67
-
68
- it "calls the old class" do
69
- expect(AddressFinder::Verification).to receive_message_chain(:new, :perform, :result)
70
- subject
71
- end
72
- end
73
- end
74
- end
data/spec/spec_helper.rb DELETED
@@ -1,20 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
-
8
- require 'rubygems'
9
- require 'bundler'
10
- require 'webmock/rspec'
11
- require 'addressfinder'
12
-
13
- RSpec.configure do |config|
14
- config.mock_with :rspec
15
-
16
- config.filter_run :focus => true
17
- config.run_all_when_everything_filtered = true
18
- end
19
-
20
- WebMock.disable_net_connect!