codeforces 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/spec/helper_spec.rb CHANGED
@@ -4,6 +4,64 @@ describe Codeforces::Helper, :vcr => true do
4
4
 
5
5
  let!(:client) { Codeforces::Client.new }
6
6
 
7
+ describe "#contest" do
8
+
9
+ context "contest 154" do
10
+ subject! { client.contest 154 }
11
+ it { expect(subject.name).to eq "Codeforces Round #109 (Div. 1)" }
12
+ end
13
+
14
+ context "contest Codeforces Round #109 (Div. 1)" do
15
+ subject! { client.contest "Codeforces Round #109 (Div. 1)" }
16
+ it { expect(subject.id).to eq 154 }
17
+ end
18
+
19
+ context "contest /Codeforces.*#109.*Div\. 1/" do
20
+ subject! { client.contest /Codeforces.*#109.*Div\. 1/ }
21
+ it { expect(subject.id).to eq 154 }
22
+ end
23
+
24
+ end
25
+
26
+ describe "#users" do
27
+
28
+ context "users" do
29
+ subject! { client.users }
30
+ it { should_not be_empty }
31
+ end
32
+
33
+ context "users.grep :country => Russia" do
34
+ subject! { client.users.grep :country => "Russia" }
35
+ it { expect(subject.map &:handle).to include "Petr" }
36
+ it { expect(subject.map &:handle).to_not include "tourist" }
37
+ end
38
+
39
+ context "users.grep :country => /Russia/" do
40
+ subject! { client.users.grep :country => /^Russia$/ }
41
+ it { expect(subject.map &:handle).to include "Petr" }
42
+ it { expect(subject.map &:handle).to_not include "tourist" }
43
+ end
44
+
45
+ context "users.grep :country => Belarus" do
46
+ subject! { client.users.grep :country => "Belarus" }
47
+ it { expect(subject.map &:handle).to_not include "Petr" }
48
+ it { expect(subject.map &:handle).to include "tourist" }
49
+ end
50
+
51
+ context "users.grep :country => /Belarus/" do
52
+ subject! { client.users.grep :country => /^Belarus$/ }
53
+ it { expect(subject.map &:handle).to_not include "Petr" }
54
+ it { expect(subject.map &:handle).to include "tourist" }
55
+ end
56
+
57
+ context "users.grep :organization => Google" do
58
+ subject! { client.users.grep :organization => "Google" }
59
+ it { expect(subject.map &:handle).to include "Petr" }
60
+ it { expect(subject.map &:handle).to_not include "tourist" }
61
+ end
62
+
63
+ end # users
64
+
7
65
  describe "#each_contest" do
8
66
 
9
67
  example "it is called 450 or more times" do
@@ -28,7 +86,7 @@ describe Codeforces::Helper, :vcr => true do
28
86
  it { should eq "Russia" }
29
87
  end
30
88
 
31
- context "user(DmitriyH).submissions", :current => true do
89
+ context "user(DmitriyH).submissions" do
32
90
  subject! { client.user("DmitriyH").submissions }
33
91
  it { should be_a Array }
34
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeforces
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer
@@ -148,6 +148,7 @@ files:
148
148
  - lib/codeforces/models/base.rb
149
149
  - lib/codeforces/models/submission.rb
150
150
  - lib/codeforces/models/user.rb
151
+ - lib/codeforces/models/users.rb
151
152
  - lib/codeforces/version.rb
152
153
  - spec/api_fixtures/Codeforces_Client/_contest_hacks/hacks_374/.yml
153
154
  - spec/api_fixtures/Codeforces_Client/_contest_list/list/.yml
@@ -163,6 +164,9 @@ files:
163
164
  - spec/api_fixtures/Codeforces_Client/_user_info/info_test_tarou/.yml
164
165
  - spec/api_fixtures/Codeforces_Client/_user_rating/rating_Fefer_Ivan/.yml
165
166
  - spec/api_fixtures/Codeforces_Client/_user_status/status_Fefer_Ivan/.yml
167
+ - spec/api_fixtures/Codeforces_Helper/_contest/contest_/Codeforces_109_Div_1/.yml
168
+ - spec/api_fixtures/Codeforces_Helper/_contest/contest_154/.yml
169
+ - spec/api_fixtures/Codeforces_Helper/_contest/contest_Codeforces_Round_109_Div_1_/.yml
166
170
  - spec/api_fixtures/Codeforces_Helper/_each_contest/.yml
167
171
  - spec/api_fixtures/Codeforces_Helper/_each_contest/it_is_called_450_or_more_times.yml
168
172
  - spec/api_fixtures/Codeforces_Helper/_each_status/first_user/.yml
@@ -212,6 +216,9 @@ test_files:
212
216
  - spec/api_fixtures/Codeforces_Client/_user_info/info_test_tarou/.yml
213
217
  - spec/api_fixtures/Codeforces_Client/_user_rating/rating_Fefer_Ivan/.yml
214
218
  - spec/api_fixtures/Codeforces_Client/_user_status/status_Fefer_Ivan/.yml
219
+ - spec/api_fixtures/Codeforces_Helper/_contest/contest_/Codeforces_109_Div_1/.yml
220
+ - spec/api_fixtures/Codeforces_Helper/_contest/contest_154/.yml
221
+ - spec/api_fixtures/Codeforces_Helper/_contest/contest_Codeforces_Round_109_Div_1_/.yml
215
222
  - spec/api_fixtures/Codeforces_Helper/_each_contest/.yml
216
223
  - spec/api_fixtures/Codeforces_Helper/_each_contest/it_is_called_450_or_more_times.yml
217
224
  - spec/api_fixtures/Codeforces_Helper/_each_status/first_user/.yml