polar-renren 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polar.rb +1 -1
- data/lib/polar/cursor.rb +1 -1
- data/spec/cursor_spec.rb +5 -2
- data/spec/stub_manager.rb +13 -2
- metadata +3 -3
data/lib/polar.rb
CHANGED
data/lib/polar/cursor.rb
CHANGED
data/spec/cursor_spec.rb
CHANGED
@@ -15,12 +15,15 @@ describe Polar::Cursor do
|
|
15
15
|
it do
|
16
16
|
subject.class.should eql Polar::Cursor
|
17
17
|
|
18
|
-
total_users =
|
18
|
+
total_users = []
|
19
19
|
while subject.next_page?
|
20
20
|
subject.each do |user|
|
21
21
|
total_users << user
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
|
+
#When we spec out pages we make the last page empty. Thats why this number is 499
|
26
|
+
total_users.count.should eql 49 * 500
|
27
|
+
|
25
28
|
end
|
26
29
|
end
|
data/spec/stub_manager.rb
CHANGED
@@ -7,10 +7,17 @@ class EndPointStub
|
|
7
7
|
WebMock.reset!
|
8
8
|
if @pages
|
9
9
|
@pages.times do |count|
|
10
|
-
|
10
|
+
File.open(file_name(count + 1), 'w') do |file_response|
|
11
|
+
file_response.puts response(count + 1)
|
12
|
+
end
|
13
|
+
|
14
|
+
stub_request(:post, "http://api.renren.com/restserver.do")
|
15
|
+
.with(:body => request_body_with_page(count + 1))
|
16
|
+
.to_return(:body => File.new(file_name(count + 1)))
|
11
17
|
end
|
12
18
|
else
|
13
|
-
stub_request(:post, "http://api.renren.com/restserver.do")
|
19
|
+
stub_request(:post, "http://api.renren.com/restserver.do")
|
20
|
+
.to_return(response(1))
|
14
21
|
end
|
15
22
|
end
|
16
23
|
|
@@ -28,6 +35,10 @@ class EndPointStub
|
|
28
35
|
raise("Abstract Method")
|
29
36
|
end
|
30
37
|
|
38
|
+
def file_name(counter)
|
39
|
+
"/tmp/#{self.class.to_s}_page_#{counter}.txt"
|
40
|
+
end
|
41
|
+
|
31
42
|
def urlencode_params(params_hash)
|
32
43
|
params = ''
|
33
44
|
stack = []
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polar-renren
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
segments:
|
119
119
|
- 0
|
120
|
-
hash:
|
120
|
+
hash: 629946179224843470
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|