stockboy 1.1.0 → 1.1.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/stockboy/providers/soap.rb +2 -0
- data/lib/stockboy/version.rb +1 -1
- data/spec/stockboy/attribute_map_spec.rb +10 -10
- data/spec/stockboy/attribute_spec.rb +7 -7
- data/spec/stockboy/candidate_record_spec.rb +18 -18
- data/spec/stockboy/configuration_spec.rb +4 -4
- data/spec/stockboy/configurator_spec.rb +24 -24
- data/spec/stockboy/filter_chain_spec.rb +4 -4
- data/spec/stockboy/filter_spec.rb +4 -4
- data/spec/stockboy/filters/missing_email_spec.rb +4 -4
- data/spec/stockboy/filters_spec.rb +4 -4
- data/spec/stockboy/job_spec.rb +24 -24
- data/spec/stockboy/mapped_record_spec.rb +5 -4
- data/spec/stockboy/provider_repeater_spec.rb +2 -2
- data/spec/stockboy/provider_spec.rb +3 -3
- data/spec/stockboy/providers/file_spec.rb +20 -20
- data/spec/stockboy/providers/ftp_spec.rb +20 -20
- data/spec/stockboy/providers/http_spec.rb +28 -28
- data/spec/stockboy/providers/imap/search_options_spec.rb +11 -11
- data/spec/stockboy/providers/imap_spec.rb +23 -23
- data/spec/stockboy/providers/soap_spec.rb +17 -17
- data/spec/stockboy/providers_spec.rb +4 -4
- data/spec/stockboy/readers/csv_spec.rb +13 -9
- data/spec/stockboy/readers/fixed_width_spec.rb +6 -6
- data/spec/stockboy/readers/json_spec.rb +1 -1
- data/spec/stockboy/readers/spreadsheet_spec.rb +15 -15
- data/spec/stockboy/readers/xml_spec.rb +12 -12
- data/spec/stockboy/readers_spec.rb +3 -3
- data/spec/stockboy/source_record_spec.rb +2 -2
- data/spec/stockboy/template_file_spec.rb +3 -3
- data/spec/stockboy/translations/boolean_spec.rb +1 -1
- data/spec/stockboy/translations/date_spec.rb +5 -5
- data/spec/stockboy/translations/decimal_spec.rb +3 -3
- data/spec/stockboy/translations/default_empty_string_spec.rb +4 -4
- data/spec/stockboy/translations/default_false_spec.rb +1 -1
- data/spec/stockboy/translations/default_nil_spec.rb +4 -4
- data/spec/stockboy/translations/default_true_spec.rb +1 -1
- data/spec/stockboy/translations/default_zero_spec.rb +4 -4
- data/spec/stockboy/translations/integer_spec.rb +2 -2
- data/spec/stockboy/translations/string_spec.rb +2 -2
- data/spec/stockboy/translations/time_spec.rb +3 -3
- data/spec/stockboy/translations/uk_date_spec.rb +5 -5
- data/spec/stockboy/translations/us_date_spec.rb +5 -5
- data/spec/stockboy/translations_spec.rb +9 -9
- data/spec/stockboy/translator_spec.rb +2 -2
- data/stockboy.gemspec +1 -1
- metadata +4 -4
@@ -23,21 +23,21 @@ module Stockboy
|
|
23
23
|
ftp.file_dir = "files/here"
|
24
24
|
ftp.file_name = %r{import_20[1-9][0-9]-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1]).csv}
|
25
25
|
|
26
|
-
ftp.host.
|
27
|
-
ftp.username.
|
28
|
-
ftp.password.
|
29
|
-
ftp.file_dir.
|
30
|
-
ftp.file_name.
|
26
|
+
expect(ftp.host).to eq "localhost.test"
|
27
|
+
expect(ftp.username).to eq "uuu"
|
28
|
+
expect(ftp.password).to eq "ppp"
|
29
|
+
expect(ftp.file_dir).to eq "files/here"
|
30
|
+
expect(ftp.file_name).to eq %r{import_20[1-9][0-9]-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1]).csv}
|
31
31
|
end
|
32
32
|
|
33
33
|
describe ".new" do
|
34
34
|
it "has no errors" do
|
35
|
-
subject.errors.
|
35
|
+
expect(subject.errors).to be_empty
|
36
36
|
end
|
37
37
|
|
38
38
|
it "accepts block initialization" do
|
39
39
|
ftp = Providers::FTP.new{ |f| f.host 'test2.local' }
|
40
|
-
ftp.host.
|
40
|
+
expect(ftp.host).to eq 'test2.local'
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -48,9 +48,9 @@ module Stockboy
|
|
48
48
|
connection = false
|
49
49
|
provider.client { |f| connection = f }
|
50
50
|
|
51
|
-
connection.
|
52
|
-
connection.binary.
|
53
|
-
connection.passive.
|
51
|
+
expect(connection).to be_a Net::FTP
|
52
|
+
expect(connection.binary).to be true
|
53
|
+
expect(connection.passive).to be true
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should return yielded result" do
|
@@ -58,7 +58,7 @@ module Stockboy
|
|
58
58
|
|
59
59
|
result = provider.client { |_| "a_file_name.csv" }
|
60
60
|
|
61
|
-
result.
|
61
|
+
expect(result).to eq "a_file_name.csv"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -67,14 +67,14 @@ module Stockboy
|
|
67
67
|
provider.host = nil
|
68
68
|
provider.data
|
69
69
|
|
70
|
-
provider.errors.first.
|
70
|
+
expect(provider.errors.first).to match /host/
|
71
71
|
end
|
72
72
|
|
73
73
|
it "adds an error on missing file_name" do
|
74
74
|
provider.file_name = nil
|
75
75
|
provider.data
|
76
76
|
|
77
|
-
provider.errors.first.
|
77
|
+
expect(provider.errors.first).to match /file_name/
|
78
78
|
end
|
79
79
|
|
80
80
|
it "downloads the last matching file" do
|
@@ -83,7 +83,7 @@ module Stockboy
|
|
83
83
|
expect(net_ftp).to receive(:get).with('20120102.csv', nil).and_return "DATA"
|
84
84
|
expect(provider).to receive(:validate_file).and_return true
|
85
85
|
|
86
|
-
provider.data.
|
86
|
+
expect(provider.data).to eq "DATA"
|
87
87
|
end
|
88
88
|
|
89
89
|
it "skips old files" do
|
@@ -94,7 +94,7 @@ module Stockboy
|
|
94
94
|
|
95
95
|
provider.file_newer = Time.new(2010,1,1)
|
96
96
|
|
97
|
-
provider.data.
|
97
|
+
expect(provider.data).to be nil
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -103,14 +103,14 @@ module Stockboy
|
|
103
103
|
net_ftp = expect_connection
|
104
104
|
expect(net_ftp).to receive(:nlst).and_return ["1.csv", "2.csv"]
|
105
105
|
|
106
|
-
provider.matching_file.
|
106
|
+
expect(provider.matching_file).to eq "2.csv"
|
107
107
|
|
108
108
|
net_ftp = expect_connection
|
109
109
|
expect(net_ftp).to receive(:nlst).and_return ["1.csv", "2.csv", "3.csv"]
|
110
110
|
|
111
|
-
provider.matching_file.
|
111
|
+
expect(provider.matching_file).to eq "2.csv"
|
112
112
|
provider.clear
|
113
|
-
provider.matching_file.
|
113
|
+
expect(provider.matching_file).to eq "3.csv"
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -124,12 +124,12 @@ module Stockboy
|
|
124
124
|
net_ftp = expect_connection
|
125
125
|
expect(net_ftp).to receive(:nlst).and_return ["1.csv", "2.csv"]
|
126
126
|
|
127
|
-
provider.matching_file.
|
127
|
+
expect(provider.matching_file).to eq "2.csv"
|
128
128
|
|
129
129
|
net_ftp = expect_connection
|
130
130
|
expect(net_ftp).to receive(:delete).with("2.csv")
|
131
131
|
|
132
|
-
provider.delete_data.
|
132
|
+
expect(provider.delete_data).to eq "2.csv"
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -10,47 +10,47 @@ module Stockboy
|
|
10
10
|
provider.query = {user: 'u'}
|
11
11
|
provider.method = :get
|
12
12
|
|
13
|
-
provider.uri.
|
14
|
-
provider.query.
|
15
|
-
provider.method.
|
13
|
+
expect(provider.uri).to eq URI("http://www.example.com/?user=u")
|
14
|
+
expect(provider.query).to eq({user: 'u'})
|
15
|
+
expect(provider.method).to eq :get
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should assign parameters from :get" do
|
19
19
|
provider.get = "http://www.example.com/"
|
20
20
|
provider.query = {user: 'u'}
|
21
21
|
|
22
|
-
provider.uri.
|
23
|
-
provider.query.
|
24
|
-
provider.method.
|
22
|
+
expect(provider.uri).to eq URI("http://www.example.com/?user=u")
|
23
|
+
expect(provider.query).to eq({user: 'u'})
|
24
|
+
expect(provider.method).to eq :get
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should assign parameters from :post" do
|
28
28
|
provider.post = "http://www.example.com/"
|
29
29
|
provider.query = {user: 'u'}
|
30
30
|
|
31
|
-
provider.uri.
|
32
|
-
provider.query.
|
33
|
-
provider.method.
|
31
|
+
expect(provider.uri).to eq URI("http://www.example.com/?user=u")
|
32
|
+
expect(provider.query).to eq({user: 'u'})
|
33
|
+
expect(provider.method).to eq :post
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should assign parameters from :headers" do
|
37
37
|
provider.headers = {"Content-Type" => "test/xml"}
|
38
38
|
|
39
|
-
provider.headers["Content-Type"].
|
39
|
+
expect(provider.headers["Content-Type"]).to eq "test/xml"
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should assign parameters from :body" do
|
43
43
|
provider.body = "<somexml></somexml>"
|
44
44
|
|
45
|
-
provider.body.
|
45
|
+
expect(provider.body).to eq "<somexml></somexml>"
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should assign basic auth parameters" do
|
49
49
|
provider.username = "username"
|
50
50
|
provider.password = "password"
|
51
51
|
|
52
|
-
provider.username.
|
53
|
-
provider.password.
|
52
|
+
expect(provider.username).to eq "username"
|
53
|
+
expect(provider.password).to eq "password"
|
54
54
|
end
|
55
55
|
|
56
56
|
describe ".new" do
|
@@ -62,9 +62,9 @@ module Stockboy
|
|
62
62
|
query user: 'u'
|
63
63
|
end
|
64
64
|
|
65
|
-
provider.uri.
|
66
|
-
provider.query.
|
67
|
-
provider.method.
|
65
|
+
expect(provider.uri).to eq URI("http://www.example.com/?user=u")
|
66
|
+
expect(provider.query).to eq({ user: 'u' })
|
67
|
+
expect(provider.method).to eq :get
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -72,35 +72,35 @@ module Stockboy
|
|
72
72
|
it "should be valid with minimal GET params" do
|
73
73
|
provider.uri = "http://example.com"
|
74
74
|
provider.method = :get
|
75
|
-
provider.
|
75
|
+
expect(provider).to be_valid
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should be valid with minimal POST params" do
|
79
79
|
provider.uri = "http://example.com"
|
80
80
|
provider.method = :post
|
81
81
|
provider.body = "<somexml></somexml>"
|
82
|
-
provider.
|
82
|
+
expect(provider).to be_valid
|
83
83
|
end
|
84
84
|
|
85
85
|
it "should not be valid without a method" do
|
86
86
|
provider.uri = "http://example.com"
|
87
87
|
provider.method = nil
|
88
|
-
provider.
|
89
|
-
provider.errors.first.
|
88
|
+
expect(provider).not_to be_valid
|
89
|
+
expect(provider.errors.first).to match /method/
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should not be valid without a uri" do
|
93
93
|
provider.uri = ""
|
94
94
|
provider.method = :get
|
95
|
-
provider.
|
96
|
-
provider.errors.first.
|
95
|
+
expect(provider).not_to be_valid
|
96
|
+
expect(provider.errors.first).to match /uri/
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should require a body for post" do
|
100
100
|
provider.uri = "http://example.com"
|
101
101
|
provider.method = :post
|
102
|
-
provider.
|
103
|
-
provider.errors.first.
|
102
|
+
expect(provider).not_to be_valid
|
103
|
+
expect(provider.errors.first).to match /body/
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -110,11 +110,11 @@ module Stockboy
|
|
110
110
|
before { provider.uri = "http://example.com/" }
|
111
111
|
|
112
112
|
it "should configure the base url" do
|
113
|
-
client.url.host.
|
113
|
+
expect(client.url.host).to eq "example.com"
|
114
114
|
end
|
115
115
|
|
116
116
|
it "returns the value of the passed block" do
|
117
|
-
provider.client { |http| "DATA" }.
|
117
|
+
expect(provider.client { |http| "DATA" }).to eq "DATA"
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -132,7 +132,7 @@ module Stockboy
|
|
132
132
|
it "returns string body on success" do
|
133
133
|
expect(HTTPI).to receive(:request) { response }
|
134
134
|
|
135
|
-
provider.data.
|
135
|
+
expect(provider.data).to eq '{"success":true}'
|
136
136
|
end
|
137
137
|
|
138
138
|
it "should setup basic auth if a username and password are supplied" do
|
@@ -142,7 +142,7 @@ module Stockboy
|
|
142
142
|
expect(HTTPI).to receive(:request) { response }
|
143
143
|
expect_any_instance_of(HTTPI::Auth::Config).to receive(:basic).with("username", "password")
|
144
144
|
|
145
|
-
provider.data.
|
145
|
+
expect(provider.data).to eq '{"success":true}'
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
@@ -6,8 +6,8 @@ module Stockboy::Providers
|
|
6
6
|
|
7
7
|
describe "to_hash" do
|
8
8
|
it "converts keys to uppercase" do
|
9
|
-
options(subject: "Improbability")
|
10
|
-
.to_hash.
|
9
|
+
expect(options(subject: "Improbability")
|
10
|
+
.to_hash).to eq({"SUBJECT" => "Improbability"})
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,8 +15,8 @@ module Stockboy::Providers
|
|
15
15
|
describe "to_imap" do
|
16
16
|
|
17
17
|
it "converts to a flat array of options" do
|
18
|
-
options(subject: "Improbability", from: "me@example.com")
|
19
|
-
.to_imap.
|
18
|
+
expect(options(subject: "Improbability", from: "me@example.com")
|
19
|
+
.to_imap).to eq ["SUBJECT", "Improbability", "FROM", "me@example.com"]
|
20
20
|
end
|
21
21
|
|
22
22
|
DATE_OPTIONS = { before: "BEFORE",
|
@@ -28,8 +28,8 @@ module Stockboy::Providers
|
|
28
28
|
|
29
29
|
DATE_OPTIONS.each do |date_option_symbol, date_option_imap|
|
30
30
|
it "converts #{date_option_imap.inspect} to IMAP date option" do
|
31
|
-
options(date_option_symbol => TIME_FORMATS.first)
|
32
|
-
.to_imap.
|
31
|
+
expect(options(date_option_symbol => TIME_FORMATS.first)
|
32
|
+
.to_imap).to eq [date_option_imap, "12-DEC-2012"]
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -39,8 +39,8 @@ module Stockboy::Providers
|
|
39
39
|
|
40
40
|
TIME_FORMATS.each do |time|
|
41
41
|
it "converts #{time.class} to IMAP date option" do
|
42
|
-
options(since: time)
|
43
|
-
.to_imap.
|
42
|
+
expect(options(since: time)
|
43
|
+
.to_imap).to eq ["SINCE", "12-DEC-2012"]
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -51,9 +51,9 @@ module Stockboy::Providers
|
|
51
51
|
|
52
52
|
BOOLEAN_OPTIONS.each do |bool_option_symbol, bool_option_imap|
|
53
53
|
it "converts #{bool_option_imap.inspect} to IMAP single value option" do
|
54
|
-
options(bool_option_symbol => true).to_imap.
|
55
|
-
options(bool_option_symbol => false).to_imap.
|
56
|
-
options(bool_option_symbol => nil).to_imap.
|
54
|
+
expect(options(bool_option_symbol => true).to_imap).to eq [bool_option_imap]
|
55
|
+
expect(options(bool_option_symbol => false).to_imap).to eq ["NOT", bool_option_imap]
|
56
|
+
expect(options(bool_option_symbol => nil).to_imap).to eq []
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -16,30 +16,30 @@ module Stockboy
|
|
16
16
|
provider.file_smaller = 1024**3
|
17
17
|
provider.file_larger = 1024
|
18
18
|
|
19
|
-
provider.host.
|
20
|
-
provider.username.
|
21
|
-
provider.password.
|
22
|
-
provider.mailbox.
|
23
|
-
provider.subject.
|
24
|
-
provider.attachment.
|
25
|
-
provider.since.
|
26
|
-
provider.file_smaller.
|
27
|
-
provider.file_larger.
|
19
|
+
expect(provider.host).to eq "mail.localhost.test"
|
20
|
+
expect(provider.username).to eq "uuu"
|
21
|
+
expect(provider.password).to eq "ppp"
|
22
|
+
expect(provider.mailbox).to eq "INBOX/Data"
|
23
|
+
expect(provider.subject).to eq %r{New Records 20[1-9][0-9]-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1])}
|
24
|
+
expect(provider.attachment).to eq %r{data-[0-9]+\.csv}
|
25
|
+
expect(provider.since).to eq Date.new(2012,12,1)
|
26
|
+
expect(provider.file_smaller).to eq 1024**3
|
27
|
+
expect(provider.file_larger).to eq 1024
|
28
28
|
end
|
29
29
|
|
30
30
|
it "aliases since to newer_than" do
|
31
31
|
provider = Providers::IMAP.new{ |f| f.newer_than Date.new(2012,12,1) }
|
32
|
-
provider.since.
|
32
|
+
expect(provider.since).to eq Date.new(2012,12,1)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "aliases file_smaller to smaller_than" do
|
36
36
|
provider = Providers::IMAP.new{ |f| f.smaller_than 1024**3 }
|
37
|
-
provider.file_smaller.
|
37
|
+
expect(provider.file_smaller).to eq 1024**3
|
38
38
|
end
|
39
39
|
|
40
40
|
describe ".new" do
|
41
41
|
it "has no errors" do
|
42
|
-
provider.errors.
|
42
|
+
expect(provider.errors).to be_empty
|
43
43
|
end
|
44
44
|
|
45
45
|
it "accepts block initialization" do
|
@@ -49,10 +49,10 @@ module Stockboy
|
|
49
49
|
file_smaller 1024**3
|
50
50
|
file_larger 1024
|
51
51
|
end
|
52
|
-
provider.host.
|
53
|
-
provider.attachment.
|
54
|
-
provider.file_smaller.
|
55
|
-
provider.file_larger.
|
52
|
+
expect(provider.host).to eq 'mail.test2.local'
|
53
|
+
expect(provider.attachment).to eq 'report.csv'
|
54
|
+
expect(provider.file_smaller).to eq 1024**3
|
55
|
+
expect(provider.file_larger).to eq 1024
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -186,7 +186,7 @@ module Stockboy
|
|
186
186
|
it "closes connections when catching exceptions" do
|
187
187
|
net_imap = expect_connection("hhh", "uuu", "ppp", "UNBOX")
|
188
188
|
provider.client { |i| raise Net::IMAP::Error }
|
189
|
-
provider.errors.first.
|
189
|
+
expect(provider.errors.first).to match /IMAP connection error/
|
190
190
|
end
|
191
191
|
|
192
192
|
end
|
@@ -197,7 +197,7 @@ module Stockboy
|
|
197
197
|
provider.subject = "Earth"
|
198
198
|
provider.from = "me@example.com"
|
199
199
|
|
200
|
-
provider.search_keys.
|
200
|
+
expect(provider.search_keys).to eq [
|
201
201
|
"SUBJECT", "Earth",
|
202
202
|
"FROM", "me@example.com",
|
203
203
|
"SINCE", "21-Dec-2012"
|
@@ -207,28 +207,28 @@ module Stockboy
|
|
207
207
|
it "replaces defaults with given options" do
|
208
208
|
provider.since = Date.new(2012, 12, 21)
|
209
209
|
provider.subject = "Earth"
|
210
|
-
provider.search_keys(subject: "Improbability").
|
210
|
+
expect(provider.search_keys(subject: "Improbability")).to eq ["SUBJECT", "Improbability"]
|
211
211
|
end
|
212
212
|
|
213
213
|
it "returns the same array given" do
|
214
|
-
provider.search_keys(["SINCE", "21-DEC-12"]).
|
214
|
+
expect(provider.search_keys(["SINCE", "21-DEC-12"])).to eq ["SINCE", "21-DEC-12"]
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
218
|
describe "#default_search_options" do
|
219
219
|
it "includes configured SUBJECT option" do
|
220
220
|
provider.subject = "Life"
|
221
|
-
provider.default_search_options.
|
221
|
+
expect(provider.default_search_options).to eq({subject: "Life"})
|
222
222
|
end
|
223
223
|
|
224
224
|
it "includes configured SINCE option" do
|
225
225
|
provider.since = Date.today
|
226
|
-
provider.default_search_options.
|
226
|
+
expect(provider.default_search_options).to eq({since: Date.today})
|
227
227
|
end
|
228
228
|
|
229
229
|
it "includes configured FROM option" do
|
230
230
|
provider.from = "me@example.com"
|
231
|
-
provider.default_search_options.
|
231
|
+
expect(provider.default_search_options).to eq({from: "me@example.com"})
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
@@ -14,11 +14,11 @@ module Stockboy
|
|
14
14
|
provider.message = {user: 'u', pass: 'p'}
|
15
15
|
provider.headers = {key: 'k'}
|
16
16
|
|
17
|
-
provider.wsdl.
|
18
|
-
provider.request.
|
19
|
-
provider.namespace.
|
20
|
-
provider.message.
|
21
|
-
provider.headers.
|
17
|
+
expect(provider.wsdl).to eq "http://api.example.com/?wsdl"
|
18
|
+
expect(provider.request).to eq :get_user
|
19
|
+
expect(provider.namespace).to eq "http://api.example.com/"
|
20
|
+
expect(provider.message).to eq({user: 'u', pass: 'p'})
|
21
|
+
expect(provider.headers).to eq({key: 'k'})
|
22
22
|
end
|
23
23
|
|
24
24
|
describe ".new" do
|
@@ -36,14 +36,14 @@ module Stockboy
|
|
36
36
|
p.headers = {key: 'k'}
|
37
37
|
end
|
38
38
|
|
39
|
-
provider.request.
|
40
|
-
provider.endpoint.
|
41
|
-
provider.wsdl.
|
42
|
-
provider.open_timeout.
|
43
|
-
provider.read_timeout.
|
44
|
-
provider.namespace.
|
45
|
-
provider.message.
|
46
|
-
provider.headers.
|
39
|
+
expect(provider.request).to eq :get_user
|
40
|
+
expect(provider.endpoint).to eq "http://api.example.com/v1"
|
41
|
+
expect(provider.wsdl).to eq "http://api.example.com/?wsdl"
|
42
|
+
expect(provider.client.globals[:open_timeout]).to eq 13
|
43
|
+
expect(provider.client.globals[:read_timeout]).to eq 99
|
44
|
+
expect(provider.namespace).to eq "http://api.example.com/namespace"
|
45
|
+
expect(provider.message).to eq({user: 'u', pass: 'p'})
|
46
|
+
expect(provider.headers).to eq({key: 'k'})
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -56,7 +56,7 @@ module Stockboy
|
|
56
56
|
context "without a WSDL document" do
|
57
57
|
it "has error for blank endpoint & WSDL namespace" do
|
58
58
|
provider.valid?
|
59
|
-
provider.errors.first.
|
59
|
+
expect(provider.errors.first).to match /endpoint/
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -66,7 +66,7 @@ module Stockboy
|
|
66
66
|
provider.endpoint = "http://api.example.com/v1"
|
67
67
|
provider.namespace = ''
|
68
68
|
provider.client do |soap|
|
69
|
-
soap.
|
69
|
+
expect(soap).to be_a Savon::Client
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -102,13 +102,13 @@ module Stockboy
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it "uses string keys" do
|
105
|
-
response.keys.each { |k| k.
|
105
|
+
response.keys.each { |k| expect(k).to be_a String }
|
106
106
|
end
|
107
107
|
|
108
108
|
it "shares key string objects from a common pool" do
|
109
109
|
cases = response["MultiNamespacedEntryResponse"]["history"]["case"]
|
110
110
|
text_keys = cases.map { |c| c.keys[c.keys.index("logText")] }
|
111
|
-
text_keys[0].
|
111
|
+
expect(text_keys[0]).to be text_keys[1]
|
112
112
|
end
|
113
113
|
|
114
114
|
end
|