Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delay memoization, stubbing, before to run.
- Loading branch information
1 parent
6515503
commit d78ed2a
Showing
17 changed files
with
108 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Typhoeus | ||
class Hydra | ||
|
||
# This module handles the request adding on | ||
# hydra. | ||
# | ||
# @api private | ||
module Addable | ||
|
||
# Adds request to multi. | ||
# | ||
# @example Add request. | ||
# hydra.add(request) | ||
# | ||
# @param [ Typhoeus::Request ] request to add. | ||
# | ||
# @return [ void ] | ||
def add(request) | ||
multi.add(Hydra::EasyFactory.new(request, self).get) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
|
||
describe Typhoeus::Hydra::Addable do | ||
let(:hydra) { Typhoeus::Hydra.new() } | ||
let(:request) { Typhoeus::Request.new("localhost:3001", {:method => :get}) } | ||
|
||
it "asks easy factory for an easy" do | ||
multi = stub | ||
Typhoeus::Hydra::EasyFactory.should_receive(:new).with(request, hydra).and_return(stub(:get => 1)) | ||
hydra.should_receive(:multi).and_return(multi) | ||
multi.should_receive(:add).with(1) | ||
hydra.add(request) | ||
end | ||
|
||
it "adds easy to multi" do | ||
multi = stub | ||
Typhoeus::Hydra::EasyFactory.should_receive(:new).with(request, hydra).and_return(stub(:get => 1)) | ||
hydra.should_receive(:multi).and_return(multi) | ||
multi.should_receive(:add).with(1) | ||
hydra.add(request) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.