torrents 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/torrents.rb +4 -1
- data/spec/torrents_spec.rb +2 -2
- data/torrents.gemspec +1 -1
- metadata +1 -1
data/lib/torrents.rb
CHANGED
@@ -119,9 +119,12 @@ class Torrents < Container::Shared
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def results
|
122
|
-
|
122
|
+
@torrents = [] if @step
|
123
|
+
return @torrents if @torrents.any?
|
124
|
+
|
123
125
|
counter = 0
|
124
126
|
rejected = 0
|
127
|
+
|
125
128
|
self.inner_torrents(self.content).each do |tr|
|
126
129
|
counter += 1
|
127
130
|
|
data/spec/torrents_spec.rb
CHANGED
@@ -232,8 +232,8 @@ describe Torrents do
|
|
232
232
|
context "the step method" do
|
233
233
|
it "should be possible to step from 0 to 10" do
|
234
234
|
10.times do |n|
|
235
|
-
RestClient.should_receive(:get).with("http://thepiratebay.org/recent/#{n}", {:timeout => 10, :cookies => nil}).exactly(1).times.and_return("")
|
236
|
-
@torrents.step.results
|
235
|
+
RestClient.should_receive(:get).with("http://thepiratebay.org/recent/#{n}", {:timeout => 10, :cookies => nil}).exactly(1).times.and_return(File.read("spec/data/the_pirate_bay/recent.html"))
|
236
|
+
@torrents.step.should have(30).results
|
237
237
|
end
|
238
238
|
end
|
239
239
|
end
|
data/torrents.gemspec
CHANGED