git-contest 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +13 -5
  2. data/.travis.yml +1 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +22 -25
  5. data/bin/git-contest +2 -2
  6. data/bin/git-contest-finish +2 -2
  7. data/bin/git-contest-init +2 -2
  8. data/bin/git-contest-rebase +2 -2
  9. data/bin/git-contest-start +2 -2
  10. data/bin/git-contest-submit +34 -17
  11. data/git-contest.gemspec +2 -2
  12. data/lib/contest/driver.rb +3 -0
  13. data/lib/contest/driver/aizu_online_judge.rb +12 -12
  14. data/lib/contest/driver/base.rb +44 -19
  15. data/lib/contest/driver/codeforces.rb +21 -15
  16. data/lib/contest/driver/common.rb +21 -5
  17. data/lib/contest/driver/driver_event.rb +1 -1
  18. data/lib/contest/driver/kattis.rb +168 -0
  19. data/lib/contest/driver/uva_online_judge.rb +14 -11
  20. data/lib/git/contest/version.rb +2 -2
  21. data/spec/bin/t004_git_contest_submit_spec.rb +143 -69
  22. data/spec/lib/contest/driver/t001_aizu_online_judge_spec.rb +46 -29
  23. data/spec/lib/contest/driver/t002_codeforces_spec.rb +185 -20
  24. data/spec/lib/contest/driver/t003_uva_online_judge_spec.rb +157 -10
  25. data/spec/lib/contest/driver/t010_kattis_spec.rb +207 -0
  26. data/spec/mock/default_config/plugins/driver_dummy.rb +31 -11
  27. data/spec/mock/t002/codeforces_after_submit.html +45 -0
  28. data/spec/mock/t002/codeforces_enter.html +67 -0
  29. data/spec/mock/t002/codeforces_submit.html +110 -0
  30. data/spec/mock/t002/codeforces_wait_result.html +58 -0
  31. data/spec/mock/t003/uva_after_quick_submit.html +17 -0
  32. data/spec/mock/t003/uva_home.html +39 -0
  33. data/spec/mock/t003/uva_my_submissions.html +111 -0
  34. data/spec/mock/t003/uva_quick_submit.html +67 -0
  35. data/spec/mock/t010/open_kattis_com_login.html +20 -0
  36. data/spec/mock/t010/open_kattis_com_submit.html +54 -0
  37. data/spec/mock/t010/open_kattis_com_user_submissions.html +28 -0
  38. data/spec/mock/t010/user_submission_111111.html +30 -0
  39. data/spec/mock/t010/user_submission_222222.html +79 -0
  40. data/spec/mock/t010/user_submissions.html +39 -0
  41. metadata +58 -27
@@ -1,12 +1,12 @@
1
1
  #
2
2
  # version.rb
3
3
  #
4
- # Copyright (c) 2013 Hiroyuki Sano <sh19910711 at gmail.com>
4
+ # Copyright (c) 2013-2014 Hiroyuki Sano <sh19910711 at gmail.com>
5
5
  # Licensed under the MIT-License.
6
6
  #
7
7
 
8
8
  module Git
9
9
  module Contest
10
- VERSION = "0.0.3"
10
+ VERSION = "0.1.0"
11
11
  end
12
12
  end
@@ -1,7 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "T004: bin/git-contest-submit" do
4
-
3
+ describe "T004: git-contest-submit command" do
5
4
  before(:each) do
6
5
  init_env
7
6
  ENV['GIT_CONTEST_HOME'] = get_path('/mock/default_config')
@@ -12,31 +11,29 @@ describe "T004: bin/git-contest-submit" do
12
11
  end
13
12
 
14
13
  after(:each) do
14
+ Dir.chdir @test_dir
15
15
  Dir.chdir '..'
16
16
  FileUtils.remove_dir @test_dir, :force => true
17
17
  end
18
18
 
19
- describe "001: version option check" do
20
-
21
- it "001: git-contest-submit --version" do
19
+ context "A001: --version" do
20
+ it "git-contest-submit --version" do
22
21
  ret = `#{bin_path("git-contest-submit")} --version`
23
- (!!ret.match(/git-contest [0-9]+\.[0-9]+\.[0-9]+/)).should === true
22
+ ret.should match /git-contest [0-9]+\.[0-9]+\.[0-9]+/
24
23
  end
25
24
 
26
- it "002: git-contest submit --version" do
25
+ it "git-contest submit --version" do
27
26
  ret = `#{bin_path("git-contest submit")} --version`
28
- (!!ret.match(/git-contest [0-9]+\.[0-9]+\.[0-9]+/)).should === true
27
+ ret.should match /git-contest [0-9]+\.[0-9]+\.[0-9]+/
29
28
  end
30
29
 
31
- it "003: git contest submit --version" do
30
+ it "git contest submit --version" do
32
31
  ret = `git contest submit --version`
33
- (!!ret.match(/git-contest [0-9]+\.[0-9]+\.[0-9]+/)).should === true
32
+ ret.should match /git-contest [0-9]+\.[0-9]+\.[0-9]+/
34
33
  end
35
-
36
34
  end
37
35
 
38
- describe "002: help check" do
39
-
36
+ context "A002: --help" do
40
37
  before do
41
38
  Dir.mkdir '002'
42
39
  Dir.chdir '002'
@@ -47,43 +44,18 @@ describe "T004: bin/git-contest-submit" do
47
44
  end
48
45
  end
49
46
 
50
- after do
51
- Dir.chdir '..'
52
- Dir.chdir '..'
53
- end
54
-
55
- describe '001: dummy driver available only test-mode' do
56
-
57
- it "001: git-contest-submit --help" do
58
- ret = `#{bin_path("git-contest-submit")} --help`
59
- ret.include?('test_dummy').should === true
60
- ret.include?('test_11111').should === true
61
- ret.include?('test_22222').should === true
62
- ret.include?('test_33333').should === true
47
+ context "B001: dummy driver available only test-mode" do
48
+ it "git-contest-submit --help" do
49
+ ret = `#{bin_path('git-contest-submit')} --help`
50
+ ret.should include 'test_dummy'
51
+ ret.should include 'test_11111'
52
+ ret.should include 'test_22222'
53
+ ret.should include 'test_33333'
63
54
  end
64
-
65
55
  end
66
-
67
- it "002: git-contest-submit test_dummy" do
68
- ret = `#{bin_path("git-contest-submit")} test_dummy 2>&1`
69
- ret.include?('Error').should === true
70
- end
71
-
72
- it "003: git-contest-submit test_dummy -c 100" do
73
- ret = `#{bin_path("git-contest-submit")} test_dummy -c 100 2>&1`
74
- ret.include?('Error').should === true
75
- end
76
-
77
- it "004: git-contest-submit test_dummy -c 100 -p A" do
78
- ret = `#{bin_path("git-contest-submit")} test_dummy -c 100 -p A 2>&1`
79
- ret.include?("99999").should === true
80
- ret.include?("Accepted").should === true
81
- end
82
-
83
56
  end
84
57
 
85
- describe '003: after init git repo' do
86
-
58
+ context "A003: after init git repo" do
87
59
  before do
88
60
  Dir.mkdir '003'
89
61
  Dir.chdir '003'
@@ -94,50 +66,152 @@ describe "T004: bin/git-contest-submit" do
94
66
  end
95
67
  end
96
68
 
97
- after do
98
- Dir.chdir '..'
99
- Dir.chdir '..'
100
- end
101
-
102
69
  before do
103
70
  `#{bin_path("git-contest")} init --defaults`
104
71
  end
105
72
 
106
- after do
107
- end
108
-
109
- it '001: submit' do
73
+ it "git-contest-submit test_dummy -c 100 -p A" do
110
74
  ret_submit = `#{bin_path("git-contest-submit")} test_dummy -c 100 -p A 2>&1`
111
- ret_submit.include?("99999").should === true
112
- ret_submit.include?("Accepted").should === true
75
+ ret_submit.should include '99999'
76
+ ret_submit.should include 'Accepted'
113
77
  ret_git = `git log --oneline --decorate --graph`
114
- ret_git.include?("Dummy 100A: Accepted").should === true
78
+ ret_git.should include "Dummy 100A: Accepted"
115
79
  end
116
-
117
80
  end
118
81
 
119
- describe "004: with commit message" do
120
-
82
+ context "A004: with commit message" do
121
83
  before do
122
84
  Dir.mkdir '004'
123
85
  Dir.chdir '004'
124
- File.open "main.cpp", "w" do |file|
125
- file.write "ac-code"
86
+ File.open 'main.cpp', 'w' do |file|
87
+ file.write 'ac-code'
126
88
  end
127
- bin_exec "init --defaults"
128
89
  end
129
90
 
130
- after do
131
- Dir.chdir '..'
91
+ before do
92
+ bin_exec "init --defaults"
132
93
  end
133
94
 
134
- it "001" do
95
+ it "git contest submit test_dummy -c 100 -p A -m '...'" do
135
96
  bin_exec "submit test_dummy -c 100 -p A -m 'this is commit message'"
136
97
  ret = git_do "log --oneline"
137
- ret.include? "this is commit message"
98
+ ret.should include "this is commit message"
99
+ end
100
+ end
101
+
102
+ context 'A005: normal submit' do
103
+ before do
104
+ Dir.mkdir '005'
105
+ Dir.chdir '005'
106
+ File.open 'main.cpp', 'w' do |file|
107
+ file.write 'ac-code'
108
+ end
109
+ end
110
+
111
+ it "git-contest-submit test_dummy" do
112
+ ret = `#{bin_path('git-contest-submit')} test_dummy 2>&1`
113
+ ret.should include 'Error'
114
+ end
115
+
116
+ it "git-contest-submit test_dummy -c 100" do
117
+ ret = `#{bin_path('git-contest-submit')} test_dummy -c 100 2>&1`
118
+ ret.should include 'Error'
119
+ end
120
+
121
+ it "git-contest-submit test_dummy -c 100 -p A" do
122
+ ret = `#{bin_path('git-contest-submit')} test_dummy -c 100 -p A 2>&1`
123
+ ret.should include '99999'
124
+ ret.should include 'Accepted'
125
+ end
126
+ end
127
+
128
+ context 'A006: --source' do
129
+ before do
130
+ Dir.mkdir '006'
131
+ Dir.chdir '006'
132
+ end
133
+
134
+ context "B001: submit single file" do
135
+ before do
136
+ File.open 'ac.cpp', 'w' do |file|
137
+ file.write 'ac-code'
138
+ end
139
+ File.open 'wa.cpp', 'w' do |file|
140
+ file.write 'wa-code'
141
+ end
142
+ end
143
+
144
+ it "git contest submit test_dummy -c 100 -p A --source ac.cpp" do
145
+ ret = bin_exec "submit test_dummy -c 100 -p A --source ac.cpp"
146
+ ret.should include '99999'
147
+ ret.should include 'Accepted'
148
+ end
149
+
150
+ it "git contest submit test_dummy -c 100 -p A -s ac.cpp" do
151
+ ret = bin_exec "submit test_dummy -c 100 -p A -s ac.cpp"
152
+ ret.should include '99999'
153
+ ret.should include 'Accepted'
154
+ end
155
+
156
+ it "git contest submit test_dummy -c 100 -p A --source wa.cpp" do
157
+ ret = bin_exec "submit test_dummy -c 100 -p A --source wa.cpp"
158
+ ret.should include '99999'
159
+ ret.should include 'Wrong Answer'
160
+ end
161
+
162
+ it "git contest submit test_dummy -c 100 -p A -s wa.cpp" do
163
+ ret = bin_exec "submit test_dummy -c 100 -p A -s wa.cpp"
164
+ ret.should include '99999'
165
+ ret.should include 'Wrong Answer'
166
+ end
138
167
  end
139
168
 
169
+ context "B002: submit multiple files" do
170
+ before do
171
+ File.open '1.cpp', 'w' do |file|
172
+ file.write 'wa-code'
173
+ end
174
+ File.open '2.cpp', 'w' do |file|
175
+ file.write 'ac-code'
176
+ end
177
+ end
178
+
179
+ it "git contest submit test_dummy -c 100 -p A --source 1.cpp,2.cpp" do
180
+ ret = bin_exec "submit test_dummy -c 100 -p A --source 1.cpp,2.cpp"
181
+ ret.should include '99999'
182
+ ret.should include 'Wrong Answer'
183
+ end
184
+
185
+ it "git contest submit test_dummy -c 100 -p A --source 2.cpp,1.cpp" do
186
+ ret = bin_exec "submit test_dummy -c 100 -p A --source 2.cpp,1.cpp"
187
+ ret.should include '99999'
188
+ ret.should include 'Accepted'
189
+ end
190
+
191
+ it "git contest submit test_dummy -c 100 -p A -s 1.cpp,2.cpp" do
192
+ ret = bin_exec "submit test_dummy -c 100 -p A -s 1.cpp,2.cpp"
193
+ ret.should include '99999'
194
+ ret.should include 'Wrong Answer'
195
+ end
196
+
197
+ it "git contest submit test_dummy -c 100 -p A -s 2.cpp,1.cpp" do
198
+ ret = bin_exec "submit test_dummy -c 100 -p A -s 2.cpp,1.cpp"
199
+ ret.should include '99999'
200
+ ret.should include 'Accepted'
201
+ end
202
+
203
+ it "git contest submit test_dummy -c 100 -p A -s 1.*,2.*" do
204
+ ret = bin_exec "submit test_dummy -c 100 -p A -s 1.*,2.*"
205
+ ret.should include '99999'
206
+ ret.should include 'Wrong Answer'
207
+ end
208
+
209
+ it "git contest submit test_dummy -c 100 -p A -s 2.*,1.*" do
210
+ ret = bin_exec "submit test_dummy -c 100 -p A -s 2.*,1.*"
211
+ ret.should include '99999'
212
+ ret.should include 'Accepted'
213
+ end
214
+ end
140
215
  end
141
-
142
216
  end
143
217
 
@@ -3,7 +3,19 @@ require 'spec_helper'
3
3
  require 'mechanize'
4
4
  require 'contest/driver/aizu_online_judge'
5
5
 
6
- describe "T001: Contest::Driver::AizuOnlineJudge" do
6
+ describe "T001: AizuOnlineJudge Driver" do
7
+ before :each do
8
+ @test_dir = "#{ENV['GIT_CONTEST_TEMP_DIR']}/t001"
9
+ Dir.mkdir @test_dir
10
+ Dir.chdir @test_dir
11
+ end
12
+
13
+ after :each do
14
+ Dir.chdir @test_dir
15
+ Dir.chdir '..'
16
+ FileUtils.remove_dir @test_dir, :force => true
17
+ end
18
+
7
19
  before do
8
20
  # setup driver
9
21
  @driver = Contest::Driver::AizuOnlineJudge.new
@@ -56,26 +68,14 @@ describe "T001: Contest::Driver::AizuOnlineJudge" do
56
68
  },
57
69
  )
58
70
 
59
- # servlet/Submit
60
- WebMock
61
- .stub_request(
62
- :post,
63
- /http:\/\/judge\.u-aizu\.ac\.jp\/onlinejudge\/servlet\/Submit/,
64
- )
65
- .to_return(
66
- :status => 200,
67
- :body => '',
68
- :headers => {
69
- 'Content-Type' => 'text/html',
70
- },
71
- )
72
71
  end
73
72
 
74
- describe "001: #get_status_wait" do
73
+ context "A001: #get_status_wait" do
75
74
  it "001: Check Status" do
76
75
  ret = @driver.get_status_wait 'test_user', '111'
77
76
  ret.should === "Wrong Answer"
78
77
  end
78
+
79
79
  it "002: Check Timeout" do
80
80
  @flag = false
81
81
  proc = Proc.new do
@@ -86,6 +86,7 @@ describe "T001: Contest::Driver::AizuOnlineJudge" do
86
86
  @driver.off 'timeout', proc
87
87
  @flag.should === true
88
88
  end
89
+
89
90
  it "002: Check Timeout noset" do
90
91
  @flag = false
91
92
  proc = Proc.new do
@@ -98,7 +99,7 @@ describe "T001: Contest::Driver::AizuOnlineJudge" do
98
99
  end
99
100
  end
100
101
 
101
- describe "002: #get_status_wait" do
102
+ context "A002: #get_status_wait" do
102
103
  before do
103
104
  # has 2 statuses
104
105
  WebMock.stub_request(
@@ -112,6 +113,7 @@ describe "T001: Contest::Driver::AizuOnlineJudge" do
112
113
  },
113
114
  )
114
115
  end
116
+
115
117
  it "001: Check Status" do
116
118
  ret = @driver.get_status_wait 'test_user', '111'
117
119
  ret.should === "Wrong Answer"
@@ -120,10 +122,26 @@ describe "T001: Contest::Driver::AizuOnlineJudge" do
120
122
  end
121
123
  end
122
124
 
123
- describe "003: #submit" do
124
- it "001: Check Event" do
125
- FileUtils.touch '/tmp/main.rb'
125
+ context "A003: #submit" do
126
+ before do
127
+ FileUtils.touch 'test_source.rb'
128
+
129
+ # servlet/Submit
130
+ WebMock
131
+ .stub_request(
132
+ :post,
133
+ /http:\/\/judge\.u-aizu\.ac\.jp\/onlinejudge\/servlet\/Submit/,
134
+ )
135
+ .to_return(
136
+ :status => 200,
137
+ :body => '',
138
+ :headers => {
139
+ 'Content-Type' => 'text/html',
140
+ },
141
+ )
142
+ end
126
143
 
144
+ it "001: Check Event" do
127
145
  @flag_start = false
128
146
  @flag_before_submit = false
129
147
  @flag_after_submit = false
@@ -157,17 +175,16 @@ describe "T001: Contest::Driver::AizuOnlineJudge" do
157
175
  @driver.on 'after_wait', proc_after_wait
158
176
  @driver.on 'finish', proc_finish
159
177
 
160
- @driver.submit(
161
- {
162
- "user" => "test_user",
163
- "password" => "password",
164
- },
165
- '/tmp/main.rb',
166
- {
167
- :contest_id => '11111',
168
- :problem_id => '22222',
169
- },
178
+ @driver.config.merge!(
179
+ "user" => "test_user",
180
+ "password" => "password",
181
+ )
182
+ @driver.options.merge!(
183
+ :contest_id => '11111',
184
+ :problem_id => '22222',
185
+ :source => 'test_source.rb',
170
186
  )
187
+ @driver.submit()
171
188
 
172
189
  @flag = @flag_start && @flag_before_submit && @flag_after_submit && @flag_before_wait && @flag_after_wait && @flag_finish
173
190
  @flag.should === true
@@ -3,31 +3,196 @@ require 'spec_helper'
3
3
  require 'contest/driver/codeforces'
4
4
  require 'mechanize'
5
5
 
6
- describe "T002: Contest::Driver::Codeforces" do
7
- before do
6
+ describe "T002: Codeforces Driver" do
7
+ before :each do
8
+ @test_dir = "#{ENV['GIT_CONTEST_TEMP_DIR']}/t002"
9
+ Dir.mkdir @test_dir
10
+ Dir.chdir @test_dir
11
+ end
12
+
13
+ after :each do
14
+ Dir.chdir @test_dir
15
+ Dir.chdir '..'
16
+ FileUtils.remove_dir @test_dir, :force => true
17
+ end
18
+
19
+ before(:each) do
8
20
  @driver = Contest::Driver::Codeforces.new
9
21
  @driver.stub(:sleep).and_return(0)
10
- @driver.client = Mechanize.new {|agent|
11
- agent.user_agent_alias = 'Windows IE 7'
12
- }
13
-
14
- # basic status_log
15
- WebMock.stub_request(
16
- :get,
17
- /http:\/\/codeforces.com\/contest\/[0-9A-Z]*\/my/
18
- ).to_return(
19
- :status => 200,
20
- :body => read_file('/mock/t002/my_submissions.html'),
21
- :header => {
22
- 'Content-Type' => 'text/html',
23
- },
24
- )
25
22
  end
26
23
 
27
- describe '001: #get_status_wait' do
28
- it '001: Check Status' do
24
+ context "A001: #get_status_wait" do
25
+ before do
26
+ # basic status_log
27
+ WebMock.stub_request(
28
+ :get,
29
+ /http:\/\/codeforces.com\/contest\/[0-9A-Z]*\/my/
30
+ ).to_return(
31
+ :status => 200,
32
+ :body => read_file('/mock/t002/my_submissions.html'),
33
+ :headers => {
34
+ 'Content-Type' => 'text/html',
35
+ },
36
+ )
37
+
38
+ @driver.client = Mechanize.new {|agent|
39
+ agent.user_agent_alias = 'Windows IE 7'
40
+ }
41
+ end
42
+
43
+ it "check status" do
29
44
  ret = @driver.get_status_wait 11111, 22222
30
- ret.should === "Accepted"
45
+ ret.should include "Accepted"
46
+ end
47
+ end
48
+
49
+ context "A002: #submit" do
50
+ before do
51
+ FileUtils.touch 'test_source.rb'
52
+
53
+ # basic status_log
54
+ WebMock.stub_request(
55
+ :get,
56
+ /http:\/\/codeforces.com\/contest\/222222\/my/
57
+ ).to_return(
58
+ :status => 200,
59
+ :body => read_file('/mock/t002/codeforces_wait_result.html'),
60
+ :headers => {
61
+ 'Content-Type' => 'text/html',
62
+ },
63
+ )
64
+
65
+ # basic status_log
66
+ WebMock.stub_request(
67
+ :get,
68
+ /http:\/\/codeforces.com\/enter/
69
+ ).to_return(
70
+ :status => 200,
71
+ :body => read_file('/mock/t002/codeforces_enter.html'),
72
+ :headers => {
73
+ 'Content-Type' => 'text/html',
74
+ },
75
+ )
76
+
77
+ # enter page
78
+ WebMock.stub_request(
79
+ :post,
80
+ /http:\/\/codeforces.com\/enter/
81
+ ).to_return(
82
+ :status => 200,
83
+ :headers => {
84
+ 'Content-Type' => 'text/html',
85
+ },
86
+ )
87
+
88
+ # submit
89
+ WebMock.stub_request(
90
+ :get,
91
+ /http:\/\/codeforces.com\/contest\/[0-9]*\/submit/
92
+ ).to_return(
93
+ :status => 200,
94
+ :body => read_file('/mock/t002/codeforces_submit.html'),
95
+ :headers => {
96
+ 'Content-Type' => 'text/html',
97
+ },
98
+ )
99
+
100
+ # submit
101
+ WebMock.stub_request(
102
+ :post,
103
+ /http:\/\/codeforces.com\/contest\/[0-9]*\/submit.*/
104
+ ).to_return(
105
+ :status => 302,
106
+ :headers => {
107
+ 'Content-Type' => 'text/html',
108
+ 'Location' => 'http://codeforces.com/after_submit',
109
+ },
110
+ )
111
+
112
+ # problemst status
113
+ WebMock.stub_request(
114
+ :get,
115
+ /http:\/\/codeforces.com\/after_submit/
116
+ ).to_return(
117
+ :status => 200,
118
+ :body => read_file('/mock/t002/codeforces_after_submit.html'),
119
+ :headers => {
120
+ 'Content-Type' => 'text/html',
121
+ },
122
+ )
123
+ end
124
+
125
+ it "should return commit message" do
126
+ @driver.config.merge!(
127
+ "user" => "test_user",
128
+ "password" => "password",
129
+ )
130
+ @driver.options.merge!(
131
+ :contest_id => '222222',
132
+ :problem_id => 'A',
133
+ :source => 'test_source.rb',
134
+ )
135
+ @driver.submit.should include "Codeforces 222222A: Accepted"
136
+ end
137
+
138
+ it "check events" do
139
+ @flag_start = false
140
+ @flag_before_login = false
141
+ @flag_after_login = false
142
+ @flag_before_submit = false
143
+ @flag_after_submit = false
144
+ @flag_before_wait = false
145
+ @flag_after_wait = false
146
+ @flag_finish = false
147
+
148
+ proc_start = Proc.new do
149
+ @flag_start = true
150
+ end
151
+ proc_before_login = Proc.new do |info|
152
+ @flag_before_login = true
153
+ end
154
+ proc_after_login = Proc.new do
155
+ @flag_after_login = true
156
+ end
157
+ proc_before_submit = Proc.new do |info|
158
+ @flag_before_submit = true
159
+ end
160
+ proc_after_submit = Proc.new do
161
+ @flag_after_submit = true
162
+ end
163
+ proc_before_wait = Proc.new do
164
+ @flag_before_wait = true
165
+ end
166
+ proc_after_wait = Proc.new do
167
+ @flag_after_wait = true
168
+ end
169
+ proc_finish = Proc.new do
170
+ @flag_finish = true
171
+ end
172
+
173
+ @driver.on 'start', proc_start
174
+ @driver.on 'before_login', proc_before_login
175
+ @driver.on 'after_login', proc_after_login
176
+ @driver.on 'before_submit', proc_before_submit
177
+ @driver.on 'after_submit', proc_after_submit
178
+ @driver.on 'before_wait', proc_before_wait
179
+ @driver.on 'after_wait', proc_after_wait
180
+ @driver.on 'finish', proc_finish
181
+
182
+ @driver.config.merge!(
183
+ "user" => "test_user",
184
+ "password" => "password",
185
+ )
186
+ @driver.options.merge!(
187
+ :contest_id => '222222',
188
+ :problem_id => 'A',
189
+ :source => 'test_source.rb',
190
+ )
191
+
192
+ @driver.submit
193
+
194
+ @flag = @flag_start && @flag_before_login && @flag_after_login && @flag_before_submit && @flag_after_submit && @flag_before_wait && @flag_after_wait && @flag_finish
195
+ @flag.should === true
31
196
  end
32
197
  end
33
198
  end