forked from dsjoerg/ggtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesdb_controller_spec.rb
More file actions
53 lines (41 loc) · 1.77 KB
/
esdb_controller_spec.rb
File metadata and controls
53 lines (41 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require 'spec_helper'
describe EsdbController do
describe :callback do
it 'should identify and update a replay by esdb job id for replay_progress' do
if Rails.configuration.s3['replays']['access_key_id'] == 'YOUR_ACCESS_KEY'
pending("can't test this without configuring Amazon S3")
end
replay = FactoryGirl.create(:replay)
replay.uploaded!
# Again, I kindof enjoy the new Hash syntax.
# TODO: consider using it everywhere? It's JSON'ish after all..
get :callback, call: 'replay_progress', progress: 25, status: 'computing!', job: replay.esdb_id
replay.reload
puts replay.inspect
replay.progress.should == 25
replay.status.should == 'computing!'
replay.state.should == 'processing'
end
it 'should identify and update a replay by esdb job id for replay_error' do
if Rails.configuration.s3['replays']['access_key_id'] == 'YOUR_ACCESS_KEY'
pending("can't test this without configuring Amazon S3")
end
replay = FactoryGirl.create(:replay)
replay.uploaded!
get :callback, call: 'replay_error', job: replay.esdb_id
replay.reload
replay.state.should == 'failed'
end
# TODO: might want a replay_done callback or something instead, not sure yet.
it 'should set the replay status to parsing/done when progress reaches 100%' do
if Rails.configuration.s3['replays']['access_key_id'] == 'YOUR_ACCESS_KEY'
pending("can't test this without configuring Amazon S3")
end
replay = FactoryGirl.create(:replay)
replay.uploaded!
get :callback, call: 'replay_progress', progress: 100, status: 'done!', job: replay.esdb_id
replay.reload
replay.state.should == 'done'
end
end
end