economy 4.0.2.2 → 5.1.0
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/MIT-LICENSE +1 -1
- data/README.md +5 -5
- data/Rakefile +1 -3
- data/lib/economy.rb +2 -0
- data/lib/economy/cache.rb +3 -3
- data/lib/economy/configuration.rb +1 -1
- data/lib/economy/money.rb +6 -3
- data/lib/economy/version.rb +1 -1
- data/lib/generators/economy/install/install_generator.rb +6 -6
- data/lib/generators/economy/install/templates/{migration.rb → create_exchanges.rb} +0 -0
- data/lib/generators/economy/install/templates/{initializer.rb → economy.rb} +0 -0
- data/lib/generators/economy/install/templates/{configuration.yml → redis.yml} +0 -0
- metadata +20 -136
- data/test/dummy/Rakefile +0 -5
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/plan.rb +0 -5
- data/test/dummy/app/models/product.rb +0 -5
- data/test/dummy/app/views/layouts/application.html.erb +0 -12
- data/test/dummy/bin/bundle +0 -4
- data/test/dummy/bin/rails +0 -5
- data/test/dummy/bin/rake +0 -5
- data/test/dummy/bin/setup +0 -30
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -25
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -10
- data/test/dummy/config/database.yml.travis +0 -3
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/economy.rb +0 -19
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/redis.yml +0 -9
- data/test/dummy/config/routes.rb +0 -56
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20161115135521_create_exchanges.rb +0 -14
- data/test/dummy/db/migrate/20161115145905_create_products.rb +0 -10
- data/test/dummy/db/migrate/20161115150024_create_plans.rb +0 -11
- data/test/dummy/db/schema.rb +0 -45
- data/test/dummy/log/development.log +0 -224
- data/test/dummy/log/test.log +0 -4988
- data/test/dummy/public/404.html +0 -61
- data/test/dummy/public/422.html +0 -61
- data/test/dummy/public/500.html +0 -60
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/yahoo/multiple.json +0 -29
- data/test/fixtures/yahoo/single.json +0 -18
- data/test/fixtures/yahoo/unknown.json +0 -18
- data/test/generator_test.rb +0 -20
- data/test/money_test.rb +0 -142
- data/test/rate_test.rb +0 -60
- data/test/record_test.rb +0 -60
- data/test/support/money_helper.rb +0 -30
- data/test/support/rate_helper.rb +0 -16
- data/test/task_test.rb +0 -22
- data/test/test_helper.rb +0 -14
data/test/dummy/public/404.html
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
div.dialog {
|
15
|
-
width: 95%;
|
16
|
-
max-width: 33em;
|
17
|
-
margin: 4em auto 0;
|
18
|
-
}
|
19
|
-
div.dialog > div {
|
20
|
-
border: 1px solid #CCC;
|
21
|
-
border-right-color: #999;
|
22
|
-
border-left-color: #999;
|
23
|
-
border-bottom-color: #BBB;
|
24
|
-
border-top: #B00100 solid 4px;
|
25
|
-
border-top-left-radius: 9px;
|
26
|
-
border-top-right-radius: 9px;
|
27
|
-
background-color: white;
|
28
|
-
padding: 7px 12% 0;
|
29
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
-
}
|
31
|
-
h1 {
|
32
|
-
font-size: 100%;
|
33
|
-
color: #730E15;
|
34
|
-
line-height: 1.5em;
|
35
|
-
}
|
36
|
-
div.dialog > p {
|
37
|
-
margin: 0 0 1em;
|
38
|
-
padding: 1em;
|
39
|
-
background-color: #F7F7F7;
|
40
|
-
border: 1px solid #CCC;
|
41
|
-
border-right-color: #999;
|
42
|
-
border-left-color: #999;
|
43
|
-
border-bottom-color: #999;
|
44
|
-
border-bottom-left-radius: 4px;
|
45
|
-
border-bottom-right-radius: 4px;
|
46
|
-
border-top-color: #DADADA;
|
47
|
-
color: #666;
|
48
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
-
}
|
50
|
-
</style>
|
51
|
-
</head>
|
52
|
-
<body>
|
53
|
-
<div class="dialog">
|
54
|
-
<div>
|
55
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
56
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
57
|
-
</div>
|
58
|
-
<p>If you are the application owner check the logs for more information.</p>
|
59
|
-
</div>
|
60
|
-
</body>
|
61
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
div.dialog {
|
15
|
-
width: 95%;
|
16
|
-
max-width: 33em;
|
17
|
-
margin: 4em auto 0;
|
18
|
-
}
|
19
|
-
div.dialog > div {
|
20
|
-
border: 1px solid #CCC;
|
21
|
-
border-right-color: #999;
|
22
|
-
border-left-color: #999;
|
23
|
-
border-bottom-color: #BBB;
|
24
|
-
border-top: #B00100 solid 4px;
|
25
|
-
border-top-left-radius: 9px;
|
26
|
-
border-top-right-radius: 9px;
|
27
|
-
background-color: white;
|
28
|
-
padding: 7px 12% 0;
|
29
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
-
}
|
31
|
-
h1 {
|
32
|
-
font-size: 100%;
|
33
|
-
color: #730E15;
|
34
|
-
line-height: 1.5em;
|
35
|
-
}
|
36
|
-
div.dialog > p {
|
37
|
-
margin: 0 0 1em;
|
38
|
-
padding: 1em;
|
39
|
-
background-color: #F7F7F7;
|
40
|
-
border: 1px solid #CCC;
|
41
|
-
border-right-color: #999;
|
42
|
-
border-left-color: #999;
|
43
|
-
border-bottom-color: #999;
|
44
|
-
border-bottom-left-radius: 4px;
|
45
|
-
border-bottom-right-radius: 4px;
|
46
|
-
border-top-color: #DADADA;
|
47
|
-
color: #666;
|
48
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
-
}
|
50
|
-
</style>
|
51
|
-
</head>
|
52
|
-
<body>
|
53
|
-
<div class="dialog">
|
54
|
-
<div>
|
55
|
-
<h1>The change you wanted was rejected.</h1>
|
56
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
57
|
-
</div>
|
58
|
-
<p>If you are the application owner check the logs for more information.</p>
|
59
|
-
</div>
|
60
|
-
</body>
|
61
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
div.dialog {
|
15
|
-
width: 95%;
|
16
|
-
max-width: 33em;
|
17
|
-
margin: 4em auto 0;
|
18
|
-
}
|
19
|
-
div.dialog > div {
|
20
|
-
border: 1px solid #CCC;
|
21
|
-
border-right-color: #999;
|
22
|
-
border-left-color: #999;
|
23
|
-
border-bottom-color: #BBB;
|
24
|
-
border-top: #B00100 solid 4px;
|
25
|
-
border-top-left-radius: 9px;
|
26
|
-
border-top-right-radius: 9px;
|
27
|
-
background-color: white;
|
28
|
-
padding: 7px 12% 0;
|
29
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
-
}
|
31
|
-
h1 {
|
32
|
-
font-size: 100%;
|
33
|
-
color: #730E15;
|
34
|
-
line-height: 1.5em;
|
35
|
-
}
|
36
|
-
div.dialog > p {
|
37
|
-
margin: 0 0 1em;
|
38
|
-
padding: 1em;
|
39
|
-
background-color: #F7F7F7;
|
40
|
-
border: 1px solid #CCC;
|
41
|
-
border-right-color: #999;
|
42
|
-
border-left-color: #999;
|
43
|
-
border-bottom-color: #999;
|
44
|
-
border-bottom-left-radius: 4px;
|
45
|
-
border-bottom-right-radius: 4px;
|
46
|
-
border-top-color: #DADADA;
|
47
|
-
color: #666;
|
48
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
-
}
|
50
|
-
</style>
|
51
|
-
</head>
|
52
|
-
<body>
|
53
|
-
<div class="dialog">
|
54
|
-
<div>
|
55
|
-
<h1>We're sorry, but something went wrong.</h1>
|
56
|
-
</div>
|
57
|
-
<p>If you are the application owner check the logs for more information.</p>
|
58
|
-
</div>
|
59
|
-
</body>
|
60
|
-
</html>
|
File without changes
|
@@ -1,29 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"query": {
|
3
|
-
"count": 2,
|
4
|
-
"created": "2016-09-12T22: 16: 22Z",
|
5
|
-
"lang": "en-US",
|
6
|
-
"results": {
|
7
|
-
"rate": [
|
8
|
-
{
|
9
|
-
"id": "USDUYU",
|
10
|
-
"Name": "USD/UYU",
|
11
|
-
"Rate": "29.3200",
|
12
|
-
"Date": "9/12/2016",
|
13
|
-
"Time": "8: 51pm",
|
14
|
-
"Ask": "29.4200",
|
15
|
-
"Bid": "29.3200"
|
16
|
-
},
|
17
|
-
{
|
18
|
-
"id": "UYUUSD",
|
19
|
-
"Name": "UYU/USD",
|
20
|
-
"Rate": "0.0341",
|
21
|
-
"Date": "9/12/2016",
|
22
|
-
"Time": "8: 51pm",
|
23
|
-
"Ask": "0.0341",
|
24
|
-
"Bid": "0.0341"
|
25
|
-
}
|
26
|
-
]
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"query": {
|
3
|
-
"count": 1,
|
4
|
-
"created": "2016-09-12T22: 12: 56Z",
|
5
|
-
"lang": "en-US",
|
6
|
-
"results": {
|
7
|
-
"rate": {
|
8
|
-
"id": "USDUYU",
|
9
|
-
"Name": "USD/UYU",
|
10
|
-
"Rate": "29.3200",
|
11
|
-
"Date": "9/12/2016",
|
12
|
-
"Time": "8: 51pm",
|
13
|
-
"Ask": "29.4200",
|
14
|
-
"Bid": "29.3200"
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"query": {
|
3
|
-
"count": 1,
|
4
|
-
"created": "2016-09-12T22: 44: 50Z",
|
5
|
-
"lang": "en-US",
|
6
|
-
"results": {
|
7
|
-
"rate": {
|
8
|
-
"id": "KKKQQQ",
|
9
|
-
"Name": "N/A",
|
10
|
-
"Rate": "N/A",
|
11
|
-
"Date": "N/A",
|
12
|
-
"Time": "N/A",
|
13
|
-
"Ask": "N/A",
|
14
|
-
"Bid": "N/A"
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
data/test/generator_test.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'rails/generators'
|
3
|
-
require 'generators/economy/install/install_generator'
|
4
|
-
|
5
|
-
class GeneratorTest < Rails::Generators::TestCase
|
6
|
-
destination Rails.root.join('tmp')
|
7
|
-
|
8
|
-
teardown do
|
9
|
-
FileUtils.rm_rf destination_root
|
10
|
-
end
|
11
|
-
|
12
|
-
test 'install' do
|
13
|
-
self.class.tests Economy::Generators::InstallGenerator
|
14
|
-
run_generator
|
15
|
-
assert_file 'config/initializers/economy.rb'
|
16
|
-
assert_file 'config/redis.yml'
|
17
|
-
assert_migration 'db/migrate/create_exchanges.rb'
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
data/test/money_test.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MoneyTest < ActiveSupport::TestCase
|
4
|
-
include MoneyHelper
|
5
|
-
|
6
|
-
test 'abs and magnitude' do
|
7
|
-
%i(abs magnitude).each do |method|
|
8
|
-
assert_equal 10, money(-10, 'USD').send(method).amount
|
9
|
-
assert_equal 10, money(10, 'USD').send(method).amount
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
test '-@' do
|
14
|
-
assert_equal -10, (-money(10, 'USD')).amount
|
15
|
-
assert_equal 10, (-money(-10, 'USD')).amount
|
16
|
-
end
|
17
|
-
|
18
|
-
test 'positive?' do
|
19
|
-
assert money(10, 'USD').positive?
|
20
|
-
assert_not money(-10, 'USD').positive?
|
21
|
-
assert_not money(0, 'USD').positive?
|
22
|
-
end
|
23
|
-
|
24
|
-
test 'negative?' do
|
25
|
-
assert money(-10, 'USD').negative?
|
26
|
-
assert_not money(10, 'USD').negative?
|
27
|
-
assert_not money(0, 'USD').negative?
|
28
|
-
end
|
29
|
-
|
30
|
-
test 'zero?' do
|
31
|
-
assert money(0, 'USD').zero?
|
32
|
-
assert_not money(4, 'USD').zero?
|
33
|
-
end
|
34
|
-
|
35
|
-
test 'nonzero?' do
|
36
|
-
assert money(4, 'USD').nonzero?
|
37
|
-
assert_not money(0, 'USD').nonzero?
|
38
|
-
end
|
39
|
-
|
40
|
-
test '<' do
|
41
|
-
assert_operator money(2, 'USD'), :<, money(4, 'USD')
|
42
|
-
assert_not_operator money(2, 'USD'), :<, money(2, 'USD')
|
43
|
-
assert_not_operator money(2, 'USD'), :<, money(10, 'UYU')
|
44
|
-
assert_raises do
|
45
|
-
money(10, 'USD') < 4
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
test '===' do
|
50
|
-
assert_operator money(10, 'USD'), :===, money(10, 'USD')
|
51
|
-
assert_not_operator money(10, 'USD'), :===, money(10, 'UYU')
|
52
|
-
assert_raises do
|
53
|
-
money(10, 'USD') === 10
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
test '<=>' do
|
58
|
-
assert_equal -1, (money(5, 'USD') <=> money(10, 'USD'))
|
59
|
-
assert_equal 0, (money(10, 'USD') <=> money(10, 'USD'))
|
60
|
-
assert_equal 1, (money(10, 'USD') <=> money(5, 'UYU'))
|
61
|
-
assert_raises do
|
62
|
-
money(10, 'USD') <=> 4
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
test '+' do
|
67
|
-
assert_equal 17, (money(10, 'USD') + money(7, 'USD')).amount
|
68
|
-
assert_equal 20, (money(5, 'USD') + money(300, 'UYU')).amount
|
69
|
-
assert_raises do
|
70
|
-
money(10, 'USD') + 4
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
test '-' do
|
75
|
-
assert_equal 3, (money(10, 'USD') - money(7, 'USD')).amount
|
76
|
-
assert_equal 5, (money(10, 'USD') - money(100, 'UYU')).amount
|
77
|
-
assert_raises do
|
78
|
-
money(10, 'USD') - 5
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
test '*' do
|
83
|
-
assert_equal 30, (money(10, 'USD') * 3).amount
|
84
|
-
assert_raises do
|
85
|
-
money(10, 'USD') * money(3, 'USD')
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
test '/ and div' do
|
90
|
-
%i(/ div).each do |operator|
|
91
|
-
assert_equal 5, (money(10, 'USD').send(operator, 2)).amount
|
92
|
-
assert_equal 5, (money(10, 'USD').send(operator, money(40, 'UYU')))
|
93
|
-
assert_raises do
|
94
|
-
money(10, 'USD').send operator, 'a'
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
test 'divmod' do
|
100
|
-
assert_equal [money(3, 'USD'), money(1, 'USD')], money(13, 'USD').divmod(4)
|
101
|
-
assert_equal [3, money(1, 'USD')], money(13, 'USD').divmod(money(80, 'UYU'))
|
102
|
-
assert_raises do
|
103
|
-
money(10, 'USD').divmod 'a'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
test '% and modulo' do
|
108
|
-
%i(% modulo).each do |operator|
|
109
|
-
assert_equal money(1, 'USD'), money(13, 'USD').send(operator, 4)
|
110
|
-
assert_equal money(1, 'USD'), money(13, 'USD').send(operator, money(80, 'UYU'))
|
111
|
-
assert_raises do
|
112
|
-
money(10, 'USD').divmod 'a'
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
test 'remainder' do
|
118
|
-
assert_equal money(1, 'USD'), money(13, 'USD').remainder(4)
|
119
|
-
assert_equal money(1, 'USD'), money(13, 'USD').remainder(money(80, 'UYU'))
|
120
|
-
end
|
121
|
-
|
122
|
-
test 'exchange_to' do
|
123
|
-
assert_raises do
|
124
|
-
money(10, 'USD').exchange_to 'EUR'
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
test 'to_json and as_json' do
|
129
|
-
%i(to_json as_json).each do |method|
|
130
|
-
assert_equal '10.70', money(10.7, 'USD').send(method)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
test 'to_s' do
|
135
|
-
assert_equal 'U$S122,444.46', money(122444.45544, 'USD').to_s
|
136
|
-
end
|
137
|
-
|
138
|
-
test 'coerce' do
|
139
|
-
assert_equal money(4, 'USD'), (4 * money(1, 'USD'))
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|
data/test/rate_test.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class RateTest < ActiveSupport::TestCase
|
4
|
-
include RateHelper
|
5
|
-
|
6
|
-
test 'retries' do
|
7
|
-
base = Economy::Rates::Base.new
|
8
|
-
base.expects(:call).raises('Error').times(31)
|
9
|
-
base.expects(:sleep).with(60).times(30)
|
10
|
-
silence_stream(STDOUT) do
|
11
|
-
base.fetch
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
test 'yahoo' do
|
16
|
-
ids = Economy.currencies.map(&:iso_code).permutation(2).map(&:join).join(',')
|
17
|
-
uri = URI('https://query.yahooapis.com/v1/public/yql')
|
18
|
-
uri.query = URI.encode_www_form(
|
19
|
-
q: "select * from yahoo.finance.xchange where pair in ('#{ids}')",
|
20
|
-
env: 'store://datatables.org/alltableswithkeys',
|
21
|
-
format: 'json'
|
22
|
-
)
|
23
|
-
assert_response(
|
24
|
-
:yahoo,
|
25
|
-
uri,
|
26
|
-
[['USD','UYU',29.3200]],
|
27
|
-
'200',
|
28
|
-
:single
|
29
|
-
)
|
30
|
-
assert_response(
|
31
|
-
:yahoo,
|
32
|
-
uri,
|
33
|
-
[['USD','UYU',29.3200],['UYU','USD',0.0341]],
|
34
|
-
'200',
|
35
|
-
:multiple
|
36
|
-
)
|
37
|
-
assert_response(
|
38
|
-
:yahoo,
|
39
|
-
uri,
|
40
|
-
[],
|
41
|
-
'200',
|
42
|
-
:unknown
|
43
|
-
)
|
44
|
-
assert_response(
|
45
|
-
:yahoo,
|
46
|
-
uri,
|
47
|
-
[],
|
48
|
-
'500'
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def assert_response(service, uri, result, code, name=nil)
|
55
|
-
response = mock_response(service, code, name)
|
56
|
-
Net::HTTP.stubs(:get_response).with(uri).returns response
|
57
|
-
assert_equal result, Economy::Rates::Yahoo.new.fetch
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|