stockboy 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -9,22 +9,22 @@ module Stockboy
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns zero for nil" do
|
11
11
|
result = subject.call count: nil
|
12
|
-
result.
|
12
|
+
expect(result).to eq 0
|
13
13
|
end
|
14
14
|
|
15
15
|
it "returns zero for empty string" do
|
16
16
|
result = subject.call count: ""
|
17
|
-
result.
|
17
|
+
expect(result).to eq 0
|
18
18
|
end
|
19
19
|
|
20
20
|
it "returns original value if present" do
|
21
21
|
result = subject.call count: 42
|
22
|
-
result.
|
22
|
+
expect(result).to eq 42
|
23
23
|
end
|
24
24
|
|
25
25
|
it "returns original value when zero" do
|
26
26
|
result = subject.call count: 0
|
27
|
-
result.
|
27
|
+
expect(result).to eq 0
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -9,12 +9,12 @@ module Stockboy
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns nil for an empty string" do
|
11
11
|
result = subject.call id: ""
|
12
|
-
result.
|
12
|
+
expect(result).to be nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "returns an integer" do
|
16
16
|
result = subject.call id: "42"
|
17
|
-
result.
|
17
|
+
expect(result).to eq 42
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -9,12 +9,12 @@ module Stockboy
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns '' for nil" do
|
11
11
|
result = subject.call name: nil
|
12
|
-
result.
|
12
|
+
expect(result).to eq ""
|
13
13
|
end
|
14
14
|
|
15
15
|
it "strips trailing & leading whitespace" do
|
16
16
|
result = subject.call name: " Arthur \n"
|
17
|
-
result.
|
17
|
+
expect(result).to eq "Arthur"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -9,17 +9,17 @@ module Stockboy
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns nil for an empty string" do
|
11
11
|
result = subject.call start: ""
|
12
|
-
result.
|
12
|
+
expect(result).to be nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "returns a time" do
|
16
16
|
result = subject.call start: "2013-12-11 10:09:08"
|
17
|
-
result.
|
17
|
+
expect(result).to eq Time.utc(2013,12,11,10,9,8)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "respects timezone" do
|
21
21
|
result = subject.call start: "2013-12-11 10:09:08 -0800"
|
22
|
-
result.
|
22
|
+
expect(result).to eq Time.utc(2013,12,11,18,9,8)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -9,27 +9,27 @@ module Stockboy
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns nil for an empty string" do
|
11
11
|
result = subject.call start: ""
|
12
|
-
result.
|
12
|
+
expect(result).to be nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "translates DD/MM/YYYY" do
|
16
16
|
result = subject.call start: "15/4/2013"
|
17
|
-
result.
|
17
|
+
expect(result).to eq Date.new(2013,4,15)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "translates DD/MM/YY" do
|
21
21
|
result = subject.call start: "15/4/13"
|
22
|
-
result.
|
22
|
+
expect(result).to eq Date.new(2013,4,15)
|
23
23
|
end
|
24
24
|
|
25
25
|
it "translates DD-MM-YYYY" do
|
26
26
|
result = subject.call start: "15-4-2013"
|
27
|
-
result.
|
27
|
+
expect(result).to eq Date.new(2013,4,15)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "translates DD-MM-YY" do
|
31
31
|
result = subject.call start: "15-4-13"
|
32
|
-
result.
|
32
|
+
expect(result).to eq Date.new(2013,4,15)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -9,27 +9,27 @@ module Stockboy
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns nil for an empty string" do
|
11
11
|
result = subject.call start: ""
|
12
|
-
result.
|
12
|
+
expect(result).to be nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "translates MM/DD/YYYY" do
|
16
16
|
result = subject.call start: "4/6/2013"
|
17
|
-
result.
|
17
|
+
expect(result).to eq Date.new(2013,4,6)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "translates MM/DD/YY" do
|
21
21
|
result = subject.call start: "4/6/13"
|
22
|
-
result.
|
22
|
+
expect(result).to eq Date.new(2013,4,6)
|
23
23
|
end
|
24
24
|
|
25
25
|
it "translates MM-DD-YYYY" do
|
26
26
|
result = subject.call start: "4-6-2013"
|
27
|
-
result.
|
27
|
+
expect(result).to eq Date.new(2013,4,6)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "translates MM-DD-YY" do
|
31
31
|
result = subject.call start: "4-6-13"
|
32
|
-
result.
|
32
|
+
expect(result).to eq Date.new(2013,4,6)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -24,7 +24,7 @@ module Stockboy
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "rejects non-callable objects" do
|
27
|
-
expect { Translations.register(:wrong, Object) }.to raise_error
|
27
|
+
expect { Translations.register(:wrong, Object) }.to raise_error ArgumentError
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -32,12 +32,12 @@ module Stockboy
|
|
32
32
|
it "translates a string" do
|
33
33
|
Translations.register :personalize, "Dear Mr. ".public_method(:<<)
|
34
34
|
|
35
|
-
Translations.translate(:personalize, "Fun").
|
35
|
+
expect(Translations.translate(:personalize, "Fun")).to eq "Dear Mr. Fun"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "translates from a proc" do
|
39
39
|
myproc = proc { |context| "Dear Mr. #{context[:first_name]}" }
|
40
|
-
Translations.translate(myproc, {first_name: "Fun"}).
|
40
|
+
expect(Translations.translate(myproc, {first_name: "Fun"})).to eq "Dear Mr. Fun"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -45,24 +45,24 @@ module Stockboy
|
|
45
45
|
it "returns a translator for a registered proc" do
|
46
46
|
Translations.register :test, ->(i){ i.message.upcase }
|
47
47
|
tr = Translations.translator_for(:message, :test)
|
48
|
-
tr.call(double message: "no!").
|
48
|
+
expect(tr.call(double message: "no!")).to eq "NO!"
|
49
49
|
end
|
50
50
|
|
51
51
|
it "returns a translator for a registered class" do
|
52
52
|
Translations.register :test, Translations::Integer
|
53
53
|
tr = Translations.translator_for :id, :test
|
54
|
-
tr.call(double id: "42").
|
54
|
+
expect(tr.call(double id: "42")).to eq 42
|
55
55
|
end
|
56
56
|
|
57
57
|
it "returns a translator for a registered instance" do
|
58
58
|
Translations.register :test, Translations::Integer.new(:id)
|
59
59
|
tr = Translations.translator_for :anything, :test
|
60
|
-
tr.call(double id: "42").
|
60
|
+
expect(tr.call(double id: "42")).to eq 42
|
61
61
|
end
|
62
62
|
|
63
63
|
it "returns a no-op for unrecognized translators" do
|
64
64
|
tr = Translations.translator_for :id, :fail
|
65
|
-
tr.call(double id: "42").
|
65
|
+
expect(tr.call(double id: "42")).to eq "42"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -71,8 +71,8 @@ module Stockboy
|
|
71
71
|
callable = ->(i){ i.message.upcase }
|
72
72
|
Translations.register :shout, callable
|
73
73
|
|
74
|
-
Translations.find(:shout).
|
75
|
-
Translations[:shout].
|
74
|
+
expect(Translations.find(:shout)).to be callable
|
75
|
+
expect(Translations[:shout]).to be callable
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -16,10 +16,10 @@ module Stockboy
|
|
16
16
|
describe "#inspect" do
|
17
17
|
it "names its field key" do
|
18
18
|
str = Class.new(Stockboy::Translator).new(:date).inspect
|
19
|
-
str.
|
19
|
+
expect(str).to eq "#<Stockboy::Translator (date)>"
|
20
20
|
|
21
21
|
str = MyTranslator.new(:date).inspect
|
22
|
-
str.
|
22
|
+
expect(str).to eq "#<MyTranslator (date)>"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/stockboy.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.has_rdoc = false
|
23
23
|
|
24
24
|
s.add_development_dependency "rake"
|
25
|
-
s.add_development_dependency "rspec"
|
25
|
+
s.add_development_dependency "rspec", ">= 3.0"
|
26
26
|
s.add_development_dependency "rspec-its"
|
27
27
|
# s.add_development_dependency "vcr"
|
28
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stockboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Vit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-its
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|