caddie 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/caddie/crest_data_retriever.rb +10 -7
- data/app/models/caddie/crest_price_history_last_day_timestamp.rb +30 -0
- data/app/models/caddie/crest_price_history_update.rb +50 -25
- data/app/models/caddie/crest_price_history_update_log.rb +10 -0
- data/app/models/caddie/m_threaded_updater.rb +12 -10
- data/db/migrate/20160803094530_create_caddie_crest_price_history_last_day_timestamps.rb +12 -0
- data/lib/caddie/version.rb +1 -1
- data/lib/tasks/caddie_tasks.rake +4 -6
- data/{app → test/dummy/app}/models/crest_price_history.rb +0 -0
- data/test/dummy/app/models/eve_item.rb +5 -9
- data/test/dummy/db/migrate/20150815033941_add_epic_blueprint_to_eve_item.rb +5 -0
- data/test/dummy/db/migrate/20150916052729_add_market_group_ref_to_eve_item.rb +6 -0
- data/test/dummy/db/migrate/20160803143148_crest_price_history_index_rework_and_others.rb +17 -0
- data/test/dummy/db/schema.rb +25 -15
- data/test/factories/caddie/crest_price_history.rb +7 -0
- data/test/factories/caddie/crest_price_history_last_day_timestamp.rb +7 -0
- data/test/factories/caddie/crest_price_history_updates.rb +3 -0
- data/test/factories/caddie/eve_items.rb +1 -39
- data/test/factories/caddie/regions.rb +4 -27
- data/test/models/caddie/crest_data_retriever_test.rb +36 -0
- data/test/models/caddie/crest_price_history_last_day_timestamp_test.rb +102 -0
- data/test/models/caddie/crest_price_history_update_log_test.rb +15 -3
- data/test/models/caddie/crest_price_history_update_test.rb +31 -9
- data/test/models/caddie/m_threaded_updater_test.rb +13 -25
- data/test/test_helper.rb +7 -2
- metadata +64 -66
- data/lib/tasks/m_threaded_updater_test.no_rake +0 -53
- data/test/dummy/log/development.log +0 -637
- data/test/dummy/log/test.log +0 -46048
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Caddie
|
4
|
+
class CrestPriceHistoryLastDayTimestampTest < ActiveSupport::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
Caddie::CrestPriceHistoryUpdate.stubs( :get_multipage_data ).returns( [ [ { 'date' => Time.now.to_s } ], 5 ] )
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
Caddie::CrestPriceHistoryUpdate.unstub( :get_multipage_data )
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'Should create a CrestPriceHistoryLastDayTimestamp record and an history object when there is no day timestamp and no history record' do
|
15
|
+
create( :crest_price_history_update )
|
16
|
+
|
17
|
+
assert_difference 'CrestPriceHistory.count', 1 do
|
18
|
+
assert_difference 'Caddie::CrestPriceHistoryLastDayTimestamp.count', 1 do
|
19
|
+
Caddie::CrestPriceHistoryUpdate.feed_price_histories
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'Should create new histories objects but no new last day timestamps object' do
|
25
|
+
create( :crest_price_history_update )
|
26
|
+
|
27
|
+
Caddie::CrestPriceHistoryUpdate.unstub( :get_multipage_data )
|
28
|
+
Caddie::CrestPriceHistoryUpdate.stubs( :get_multipage_data ).returns( [ [ { 'date' => ( Time.now - 24 * 60 * 60 ).to_s } ], 5 ] )
|
29
|
+
Caddie::CrestPriceHistoryUpdate.feed_price_histories
|
30
|
+
|
31
|
+
Caddie::CrestPriceHistoryUpdate.unstub( :get_multipage_data )
|
32
|
+
Caddie::CrestPriceHistoryUpdate.stubs( :get_multipage_data ).returns( [ [ { 'date' => Time.now.to_s } ], 5 ] )
|
33
|
+
|
34
|
+
assert_difference 'CrestPriceHistory.count', 1 do
|
35
|
+
assert_no_difference 'Caddie::CrestPriceHistoryLastDayTimestamp.count' do
|
36
|
+
Caddie::CrestPriceHistoryUpdate.feed_price_histories
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
test 'Should update the CrestPriceHistoryLastDayTimestamp object' do
|
42
|
+
cphldt = create( :crest_price_history_last_day_timestamp, day_timestamp: Time.new( 0 ) )
|
43
|
+
|
44
|
+
assert_no_difference 'Caddie::CrestPriceHistoryLastDayTimestamp.count' do
|
45
|
+
cphldt = Caddie::CrestPriceHistoryLastDayTimestamp.create_or_update_last_day_timestamp(
|
46
|
+
cphldt, Time.now, nil, nil )
|
47
|
+
end
|
48
|
+
assert_equal Time.now.strftime( '%D' ), cphldt.day_timestamp.strftime( '%D' )
|
49
|
+
end
|
50
|
+
|
51
|
+
test 'Should create a new CrestPriceHistoryLastDayTimestamp as there is none' do
|
52
|
+
cph = create( :crest_price_history )
|
53
|
+
cphldt = nil
|
54
|
+
|
55
|
+
assert_difference 'Caddie::CrestPriceHistoryLastDayTimestamp.count' do
|
56
|
+
cphldt = Caddie::CrestPriceHistoryLastDayTimestamp.create_or_update_last_day_timestamp(
|
57
|
+
nil, Time.now, cph.region_id, cph.eve_item_id )
|
58
|
+
end
|
59
|
+
assert_equal Time.now.strftime( '%D' ), cphldt.day_timestamp.strftime( '%D' )
|
60
|
+
end
|
61
|
+
|
62
|
+
test 'Should return an update date of Time.new( 0 ) and a null last record because there is no history object' do
|
63
|
+
last_update_date, last_update_record = Caddie::CrestPriceHistoryLastDayTimestamp
|
64
|
+
.find_or_create_last_day_timestamp( -1, -1 )
|
65
|
+
|
66
|
+
assert_equal Time.new( 0 ), last_update_date
|
67
|
+
refute last_update_record
|
68
|
+
end
|
69
|
+
|
70
|
+
test 'Should return an update date equal to the created history object and no last record' do
|
71
|
+
cph = create( :crest_price_history )
|
72
|
+
|
73
|
+
last_update_date, last_update_record = Caddie::CrestPriceHistoryLastDayTimestamp
|
74
|
+
.find_or_create_last_day_timestamp( cph.region_id, cph.eve_item_id )
|
75
|
+
|
76
|
+
assert_equal cph.history_date.strftime( '%D' ), last_update_date.strftime( '%D' )
|
77
|
+
refute last_update_record
|
78
|
+
end
|
79
|
+
|
80
|
+
test 'Should return an update date equal to the latest created history object and no last record' do
|
81
|
+
cph1 = create( :crest_price_history, history_date: Time.now - 24*60*60 )
|
82
|
+
cph2 = create( :crest_price_history, region_id: cph1.region_id, eve_item_id: cph1.eve_item_id )
|
83
|
+
|
84
|
+
last_update_date, last_update_record = Caddie::CrestPriceHistoryLastDayTimestamp
|
85
|
+
.find_or_create_last_day_timestamp( cph1.region_id, cph1.eve_item_id )
|
86
|
+
|
87
|
+
assert_equal cph2.history_date.strftime( '%D' ), last_update_date.strftime( '%D' )
|
88
|
+
assert cph1.history_date < last_update_date
|
89
|
+
refute last_update_record
|
90
|
+
end
|
91
|
+
|
92
|
+
test 'Should return an update date and a last record' do
|
93
|
+
cphldt = create( :crest_price_history_last_day_timestamp )
|
94
|
+
|
95
|
+
last_update_date, last_update_record = Caddie::CrestPriceHistoryLastDayTimestamp
|
96
|
+
.find_or_create_last_day_timestamp( cphldt.region_id, cphldt.eve_item_id )
|
97
|
+
|
98
|
+
assert_equal cphldt.day_timestamp.strftime( '%D' ), last_update_date.strftime( '%D' )
|
99
|
+
assert last_update_record
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -2,8 +2,20 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Caddie
|
4
4
|
class CrestPriceHistoryUpdateLogTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
|
6
|
+
test 'Should create a new log entry' do
|
7
|
+
assert_difference 'Caddie::CrestPriceHistoryUpdateLog.count' do
|
8
|
+
Caddie::CrestPriceHistoryUpdateLog.store_log_data( Time.now.to_date, 10, 10, 50, 50, 100 )
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'Should update the log entry' do
|
13
|
+
log = nil
|
14
|
+
Caddie::CrestPriceHistoryUpdateLog.store_log_data( Time.now.to_date, 10, 10, 50, 50, 100 )
|
15
|
+
assert_no_difference 'Caddie::CrestPriceHistoryUpdateLog.count' do
|
16
|
+
log = Caddie::CrestPriceHistoryUpdateLog.store_log_data( Time.now.to_date, 10, 10, 1000, 50, 100 )
|
17
|
+
end
|
18
|
+
assert_equal 1000, log.total_inserts
|
19
|
+
end
|
8
20
|
end
|
9
21
|
end
|
@@ -1,24 +1,46 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'minitest/mock'
|
3
2
|
|
4
3
|
module Caddie
|
5
4
|
class CrestPriceHistoryUpdateTest < ActiveSupport::TestCase
|
6
5
|
|
7
6
|
def setup
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
cph = create( :crest_price_history )
|
8
|
+
@cphu = create( :crest_price_history_update, region_id: cph.region_id, eve_item_id: cph.eve_item_id )
|
9
|
+
Caddie::CrestPriceHistoryUpdate.stubs( :get_multipage_data ).returns( [ [], 5 ] )
|
10
|
+
# raise 'daily_operation_list = 0. You may recreate fixtures for today by running "RAILS_ENV=test ruby caddie_create_test_fixtures.rb"' if Caddie::CrestPriceHistoryUpdate.daily_operations_list.count == 0
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
Caddie::CrestPriceHistoryUpdate.unstub(:get_multipage_data)
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'test update for new item' do
|
18
|
+
@cphu.destroy
|
19
|
+
assert_difference 'Caddie::CrestPriceHistoryUpdate.count' do
|
20
|
+
Caddie::CrestPriceHistoryUpdate.update
|
13
21
|
end
|
14
|
-
Caddie::CrestPriceHistoryUpdate.
|
22
|
+
assert_equal 1, Caddie::CrestPriceHistoryUpdate.daily_operations_list.count
|
23
|
+
end
|
15
24
|
|
25
|
+
test 'test update for existing item' do
|
26
|
+
Caddie::CrestPriceHistoryUpdate.update
|
27
|
+
assert_no_difference 'Caddie::CrestPriceHistoryUpdate.count' do
|
28
|
+
Caddie::CrestPriceHistoryUpdate.update
|
29
|
+
end
|
30
|
+
assert_equal 1, Caddie::CrestPriceHistoryUpdate.daily_operations_list.count
|
16
31
|
end
|
17
32
|
|
18
|
-
test 'feed_price_histories' do
|
33
|
+
test 'feed_price_histories single threaded' do
|
19
34
|
result = Caddie::CrestPriceHistoryUpdate.feed_price_histories
|
20
|
-
assert_equal
|
35
|
+
assert_equal 5, result[1]
|
21
36
|
end
|
22
37
|
|
38
|
+
# Deactivated. Waiting for a better solution : the fixture solution sucks
|
39
|
+
# test 'feed_price_histories multi threaded' do
|
40
|
+
# th = Caddie::MThreadedUpdater.new( Caddie::CrestPriceHistoryUpdate::NB_THREADS, Caddie::CrestPriceHistoryUpdate.daily_operations_list )
|
41
|
+
# result = th.feed_price_histories_threaded
|
42
|
+
# assert_equal 265, result[1]
|
43
|
+
# end
|
44
|
+
|
23
45
|
end
|
24
46
|
end
|
@@ -1,26 +1,14 @@
|
|
1
|
-
|
2
|
-
# I keep this because it is a very good example of fixture creation code
|
3
|
-
#
|
4
|
-
# @region = create( :heimatar )
|
5
|
-
# next_process_date = Time.now.to_date
|
6
|
-
# objs = []
|
7
|
-
# 1.upto( 53 ).each do
|
8
|
-
# item = create( :eve_item )
|
9
|
-
#
|
10
|
-
# obj = create( :crest_price_history_update, region: @region, eve_item: item, next_process_date: next_process_date )
|
11
|
-
# objs << obj
|
12
|
-
#
|
13
|
-
# end
|
1
|
+
require 'test_helper'
|
14
2
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
module Caddie
|
4
|
+
class MThreadedUpdaterTest < ActiveSupport::TestCase
|
5
|
+
|
6
|
+
test 'Col / seconds should be a max and not a sum' do
|
7
|
+
Caddie::CrestPriceHistoryUpdate.stubs( :feed_price_histories ).returns( [ 10, 15, 20, 25 ] )
|
8
|
+
runner = Caddie::MThreadedUpdater.new( 4, Caddie::CrestPriceHistoryUpdate.daily_operations_list )
|
9
|
+
result = runner.feed_price_histories_threaded
|
10
|
+
assert_equal [ 10*4, 15*4, 20, 25*4 ], result
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Configure Rails Environment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter 'dummy'
|
7
|
+
add_filter 'factories'
|
8
|
+
end
|
9
|
+
|
4
10
|
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
11
|
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
6
12
|
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
|
@@ -27,5 +33,4 @@ end
|
|
27
33
|
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
28
34
|
Dir[File.join(ENGINE_RAILS_ROOT, "test/factories/**/*.rb")].each {|f| require f }
|
29
35
|
|
30
|
-
require '
|
31
|
-
require 'mocha/mini_test'
|
36
|
+
require 'mocha/test_unit'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caddie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zuger Cédric
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -50,20 +50,6 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.18.4
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: mocha
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '0'
|
60
|
-
type: :runtime
|
61
|
-
prerelease: false
|
62
|
-
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
requirements:
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '0'
|
67
53
|
description: A rails engine that allow to download CREST market data (designed to
|
68
54
|
be plugged into a custom application)
|
69
55
|
email:
|
@@ -79,11 +65,11 @@ files:
|
|
79
65
|
- app/controllers/caddie/application_controller.rb
|
80
66
|
- app/helpers/caddie/application_helper.rb
|
81
67
|
- app/models/caddie/crest_data_retriever.rb
|
68
|
+
- app/models/caddie/crest_price_history_last_day_timestamp.rb
|
82
69
|
- app/models/caddie/crest_price_history_update.rb
|
83
70
|
- app/models/caddie/crest_price_history_update_log.rb
|
84
71
|
- app/models/caddie/m_threaded_updater.rb
|
85
72
|
- app/models/caddie/update_table.sql
|
86
|
-
- app/models/crest_price_history.rb
|
87
73
|
- app/views/layouts/caddie/application.html.erb
|
88
74
|
- config/routes.rb
|
89
75
|
- db/migrate/20160524122651_create_caddie_crest_price_history_updates.rb
|
@@ -92,11 +78,11 @@ files:
|
|
92
78
|
- db/migrate/20160710163612_add_total_inserts_to_crest_price_history_update_log.rb
|
93
79
|
- db/migrate/20160710163641_add_co_seconds_to_crest_price_history_update_log.rb
|
94
80
|
- db/migrate/20160725091214_add_indexes_to_crest_price_history_update.rb
|
81
|
+
- db/migrate/20160803094530_create_caddie_crest_price_history_last_day_timestamps.rb
|
95
82
|
- lib/caddie.rb
|
96
83
|
- lib/caddie/engine.rb
|
97
84
|
- lib/caddie/version.rb
|
98
85
|
- lib/tasks/caddie_tasks.rake
|
99
|
-
- lib/tasks/m_threaded_updater_test.no_rake
|
100
86
|
- test/caddie_test.rb
|
101
87
|
- test/dummy/README.rdoc
|
102
88
|
- test/dummy/Rakefile
|
@@ -104,6 +90,7 @@ files:
|
|
104
90
|
- test/dummy/app/assets/stylesheets/application.css
|
105
91
|
- test/dummy/app/controllers/application_controller.rb
|
106
92
|
- test/dummy/app/helpers/application_helper.rb
|
93
|
+
- test/dummy/app/models/crest_price_history.rb
|
107
94
|
- test/dummy/app/models/eve_item.rb
|
108
95
|
- test/dummy/app/models/region.rb
|
109
96
|
- test/dummy/app/views/layouts/application.html.erb
|
@@ -134,21 +121,26 @@ files:
|
|
134
121
|
- test/dummy/db/migrate/20150414095303_add_name_lowcase_to_eve_item.rb
|
135
122
|
- test/dummy/db/migrate/20150416154256_rename_eve_item_id.rb
|
136
123
|
- test/dummy/db/migrate/20150417135716_add_cost_to_eve_item.rb
|
124
|
+
- test/dummy/db/migrate/20150815033941_add_epic_blueprint_to_eve_item.rb
|
137
125
|
- test/dummy/db/migrate/20150906171550_add_cpp_market_group_id_to_eve_item.rb
|
138
126
|
- test/dummy/db/migrate/20150909162142_add_involved_in_blueprint_to_eve_item.rb
|
139
127
|
- test/dummy/db/migrate/20150910074544_create_regions.rb
|
140
128
|
- test/dummy/db/migrate/20150910080646_create_crest_price_histories.rb
|
129
|
+
- test/dummy/db/migrate/20150916052729_add_market_group_ref_to_eve_item.rb
|
130
|
+
- test/dummy/db/migrate/20160803143148_crest_price_history_index_rework_and_others.rb
|
141
131
|
- test/dummy/db/schema.rb
|
142
|
-
- test/dummy/log/development.log
|
143
|
-
- test/dummy/log/test.log
|
144
132
|
- test/dummy/public/404.html
|
145
133
|
- test/dummy/public/422.html
|
146
134
|
- test/dummy/public/500.html
|
147
135
|
- test/dummy/public/favicon.ico
|
136
|
+
- test/factories/caddie/crest_price_history.rb
|
137
|
+
- test/factories/caddie/crest_price_history_last_day_timestamp.rb
|
148
138
|
- test/factories/caddie/crest_price_history_updates.rb
|
149
139
|
- test/factories/caddie/eve_items.rb
|
150
140
|
- test/factories/caddie/regions.rb
|
151
141
|
- test/integration/navigation_test.rb
|
142
|
+
- test/models/caddie/crest_data_retriever_test.rb
|
143
|
+
- test/models/caddie/crest_price_history_last_day_timestamp_test.rb
|
152
144
|
- test/models/caddie/crest_price_history_update_log_test.rb
|
153
145
|
- test/models/caddie/crest_price_history_update_test.rb
|
154
146
|
- test/models/caddie/m_threaded_updater_test.rb
|
@@ -173,64 +165,70 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
165
|
version: '0'
|
174
166
|
requirements: []
|
175
167
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
168
|
+
rubygems_version: 2.5.1
|
177
169
|
signing_key:
|
178
170
|
specification_version: 4
|
179
171
|
summary: Crest mArket DownloaD engInE
|
180
172
|
test_files:
|
181
|
-
- test/
|
182
|
-
- test/caddie_test.rb
|
183
|
-
- test/factories/caddie/eve_items.rb
|
184
|
-
- test/factories/caddie/regions.rb
|
185
|
-
- test/factories/caddie/crest_price_history_updates.rb
|
186
|
-
- test/test_helper.rb
|
187
|
-
- test/dummy/Rakefile
|
188
|
-
- test/dummy/README.rdoc
|
189
|
-
- test/dummy/public/500.html
|
190
|
-
- test/dummy/public/favicon.ico
|
191
|
-
- test/dummy/public/404.html
|
192
|
-
- test/dummy/public/422.html
|
193
|
-
- test/dummy/log/test.log
|
194
|
-
- test/dummy/log/development.log
|
195
|
-
- test/dummy/db/migrate/20150417135716_add_cost_to_eve_item.rb
|
196
|
-
- test/dummy/db/migrate/20150416154256_rename_eve_item_id.rb
|
197
|
-
- test/dummy/db/migrate/20150910080646_create_crest_price_histories.rb
|
198
|
-
- test/dummy/db/migrate/20150910074544_create_regions.rb
|
199
|
-
- test/dummy/db/migrate/20150906171550_add_cpp_market_group_id_to_eve_item.rb
|
200
|
-
- test/dummy/db/migrate/20150909162142_add_involved_in_blueprint_to_eve_item.rb
|
201
|
-
- test/dummy/db/migrate/20150414095303_add_name_lowcase_to_eve_item.rb
|
202
|
-
- test/dummy/db/migrate/20150410082132_create_eve_items.rb
|
203
|
-
- test/dummy/db/schema.rb
|
204
|
-
- test/dummy/config.ru
|
205
|
-
- test/dummy/config/database.yml
|
206
|
-
- test/dummy/config/routes.rb
|
207
|
-
- test/dummy/config/secrets.yml
|
208
|
-
- test/dummy/config/boot.rb
|
209
|
-
- test/dummy/config/environment.rb
|
210
|
-
- test/dummy/config/locales/en.yml
|
211
|
-
- test/dummy/config/initializers/mime_types.rb
|
212
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
173
|
+
- test/dummy/config/application.rb
|
213
174
|
- test/dummy/config/initializers/session_store.rb
|
175
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
176
|
+
- test/dummy/config/initializers/mime_types.rb
|
177
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
214
178
|
- test/dummy/config/initializers/assets.rb
|
215
|
-
- test/dummy/config/initializers/inflections.rb
|
216
179
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
217
|
-
- test/dummy/config/initializers/
|
218
|
-
- test/dummy/config/initializers/
|
180
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
181
|
+
- test/dummy/config/initializers/inflections.rb
|
219
182
|
- test/dummy/config/environments/production.rb
|
220
183
|
- test/dummy/config/environments/development.rb
|
221
184
|
- test/dummy/config/environments/test.rb
|
222
|
-
- test/dummy/config/
|
223
|
-
- test/dummy/
|
224
|
-
- test/dummy/
|
225
|
-
- test/dummy/
|
185
|
+
- test/dummy/config/environment.rb
|
186
|
+
- test/dummy/config/boot.rb
|
187
|
+
- test/dummy/config/routes.rb
|
188
|
+
- test/dummy/config/locales/en.yml
|
189
|
+
- test/dummy/config/secrets.yml
|
190
|
+
- test/dummy/config/database.yml
|
191
|
+
- test/dummy/config.ru
|
192
|
+
- test/dummy/bin/rails
|
193
|
+
- test/dummy/bin/setup
|
194
|
+
- test/dummy/bin/bundle
|
195
|
+
- test/dummy/bin/rake
|
196
|
+
- test/dummy/public/favicon.ico
|
197
|
+
- test/dummy/public/500.html
|
198
|
+
- test/dummy/public/404.html
|
199
|
+
- test/dummy/public/422.html
|
200
|
+
- test/dummy/db/schema.rb
|
201
|
+
- test/dummy/db/migrate/20150909162142_add_involved_in_blueprint_to_eve_item.rb
|
202
|
+
- test/dummy/db/migrate/20150414095303_add_name_lowcase_to_eve_item.rb
|
203
|
+
- test/dummy/db/migrate/20160803143148_crest_price_history_index_rework_and_others.rb
|
204
|
+
- test/dummy/db/migrate/20150906171550_add_cpp_market_group_id_to_eve_item.rb
|
205
|
+
- test/dummy/db/migrate/20150910080646_create_crest_price_histories.rb
|
206
|
+
- test/dummy/db/migrate/20150410082132_create_eve_items.rb
|
207
|
+
- test/dummy/db/migrate/20150916052729_add_market_group_ref_to_eve_item.rb
|
208
|
+
- test/dummy/db/migrate/20150416154256_rename_eve_item_id.rb
|
209
|
+
- test/dummy/db/migrate/20150417135716_add_cost_to_eve_item.rb
|
210
|
+
- test/dummy/db/migrate/20150910074544_create_regions.rb
|
211
|
+
- test/dummy/db/migrate/20150815033941_add_epic_blueprint_to_eve_item.rb
|
212
|
+
- test/dummy/README.rdoc
|
226
213
|
- test/dummy/app/models/eve_item.rb
|
214
|
+
- test/dummy/app/models/region.rb
|
215
|
+
- test/dummy/app/models/crest_price_history.rb
|
227
216
|
- test/dummy/app/controllers/application_controller.rb
|
228
|
-
- test/dummy/app/
|
217
|
+
- test/dummy/app/views/layouts/application.html.erb
|
229
218
|
- test/dummy/app/assets/javascripts/application.js
|
230
|
-
- test/dummy/
|
231
|
-
- test/dummy/
|
232
|
-
- test/dummy/
|
233
|
-
- test/
|
219
|
+
- test/dummy/app/assets/stylesheets/application.css
|
220
|
+
- test/dummy/app/helpers/application_helper.rb
|
221
|
+
- test/dummy/Rakefile
|
222
|
+
- test/models/caddie/crest_data_retriever_test.rb
|
234
223
|
- test/models/caddie/crest_price_history_update_log_test.rb
|
235
|
-
- test/models/caddie/crest_price_history_update_test.rb
|
236
224
|
- test/models/caddie/m_threaded_updater_test.rb
|
225
|
+
- test/models/caddie/crest_price_history_last_day_timestamp_test.rb
|
226
|
+
- test/models/caddie/crest_price_history_update_test.rb
|
227
|
+
- test/caddie_test.rb
|
228
|
+
- test/integration/navigation_test.rb
|
229
|
+
- test/factories/caddie/eve_items.rb
|
230
|
+
- test/factories/caddie/crest_price_history_last_day_timestamp.rb
|
231
|
+
- test/factories/caddie/crest_price_history_updates.rb
|
232
|
+
- test/factories/caddie/regions.rb
|
233
|
+
- test/factories/caddie/crest_price_history.rb
|
234
|
+
- test/test_helper.rb
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'mocha/api'
|
2
|
-
require 'minitest'
|
3
|
-
|
4
|
-
include Mocha::API
|
5
|
-
include FactoryGirl::Syntax::Methods
|
6
|
-
|
7
|
-
require_relative '../../test/dummy/app/models/eve_item'
|
8
|
-
require_relative '../../test/dummy/app/models/region'
|
9
|
-
require_relative '../../test/factories/caddie/eve_items'
|
10
|
-
require_relative '../../test/factories/caddie/regions'
|
11
|
-
require_relative '../../app/models/caddie/crest_data_retriever'
|
12
|
-
require_relative '../../app/models/caddie/crest_price_history_update'
|
13
|
-
require_relative '../../test/factories/caddie/crest_price_history_updates'
|
14
|
-
|
15
|
-
# Regular test unit does not commit between insertions, this algo rely on database to split work between threads
|
16
|
-
# So we have to fake a test outside the test unit
|
17
|
-
namespace :test do
|
18
|
-
|
19
|
-
desc "M threaded uptader test"
|
20
|
-
task :m_threaded_uptader_test=> :environment do
|
21
|
-
if (ENV['RAILS_ENV'] == "test") # protect against execution in dev mode
|
22
|
-
|
23
|
-
Caddie::CrestPriceHistoryUpdate.stubs( :get_multipage_data ).returns( [ [], 5 ] )
|
24
|
-
|
25
|
-
Region.delete_all
|
26
|
-
EveItem.delete_all
|
27
|
-
Caddie::CrestPriceHistoryUpdate.delete_all
|
28
|
-
|
29
|
-
next_process_date = Time.now.to_date
|
30
|
-
region = create( :caddie_heimatar )
|
31
|
-
1.upto( 53 ).each do
|
32
|
-
item = create( :caddie_eve_item )
|
33
|
-
create( :crest_price_history_update, region: region, eve_item: item, next_process_date: next_process_date )
|
34
|
-
end
|
35
|
-
|
36
|
-
th = Caddie::MThreadedUpdater.new( 4, Caddie::CrestPriceHistoryUpdate.daily_operations_list )
|
37
|
-
th.split_work_for_threads
|
38
|
-
timings = th.feed_price_histories_threaded
|
39
|
-
# pp timings
|
40
|
-
unless 53 == timings[1]/5
|
41
|
-
"Test failed : #{timings[1]/5} != 53"
|
42
|
-
else
|
43
|
-
puts 'Test passed'
|
44
|
-
end
|
45
|
-
else
|
46
|
-
puts 'Can be only executed in test env'
|
47
|
-
end
|
48
|
-
|
49
|
-
Region.delete_all
|
50
|
-
EveItem.delete_all
|
51
|
-
Caddie::CrestPriceHistoryUpdate.delete_all
|
52
|
-
end
|
53
|
-
end
|