Skip to content

Commit

Permalink
Merge pull request #2 from jigfox/test_multiple_interpolation
Browse files Browse the repository at this point in the history
test to make sure interpolation works several time
  • Loading branch information
xijo committed Dec 19, 2011
2 parents b0a9a3e + 9902a0c commit 45384d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/test_helper.rb
Expand Up @@ -25,11 +25,13 @@ def setup
hydra = Typhoeus::Hydra.hydra
@index_response = Typhoeus::Response.new(:code => 200, :body => '{ "planets" : ["mars", "earth", "venus"] }', :time => 0.3)
@mars_response = Typhoeus::Response.new(:code => 200, :body => '{ "mars" : { "density" : "3.9335 g/cm3" , "temperature" : "210K" } }', :time => 0.3)
@moon_response = Typhoeus::Response.new(:code => 200, :body => '{ "moon" : { "density" : "3.346 g/cm3", "temperature" : "57K" } }', :time => 0.3)
@error_response = Typhoeus::Response.new(:code => 404, :body => '{ "eris" : "is no planet but a TNO" }', :time => 0.3)
@put_response = Typhoeus::Response.new(:code => 403, :body => 'Creating planets is not your business!', :time => 0.3)
hydra.stub(:get, "http://astronomical.test/planets").and_return(@index_response)
hydra.stub(:get, "http://astronomical.test/planets/mars").and_return(@mars_response)
hydra.stub(:get, "http://astronomical.test/planets/moon").and_return(@moon_response)
hydra.stub(:get, "http://astronomical.test/planets/eris").and_return(@error_response)
hydra.stub(:put, "http://astronomical.test/planets").and_return(@put_response)
end
end
end
3 changes: 2 additions & 1 deletion test/test_remote_method.rb
Expand Up @@ -34,6 +34,7 @@ def test_remote_method_with_interpolation
:method => :get
)
assert_equal @mars_response.body, remote_method.run(:identifier => :mars).body
assert_equal @moon_response.body, remote_method.run(:identifier => :moon).body
end

def test_remote_method_with_empty_path
Expand Down Expand Up @@ -85,4 +86,4 @@ def test_remote_method_returns_request
)
assert_instance_of Typhoeus::Request, remote_method.run
end
end
end

0 comments on commit 45384d4

Please sign in to comment.