Permalink
Browse files

add support for post requests

  • Loading branch information...
1 parent 83d53f2 commit 711f099757b38358fd93938106ee4249b8362256 @jamesgolick committed May 1, 2009
Showing with 11 additions and 1 deletion.
  1. +4 −0 lib/trample/configuration.rb
  2. +7 −1 test/configuration_test.rb
@@ -21,6 +21,10 @@ def get(url)
@pages << Page.new(:get, url)
end
+ def post(url, params)
+ @pages << Page.new(:post, url, params)
+ end
+
def ==(other)
other.is_a?(Configuration) &&
other.pages == pages &&
@@ -7,6 +7,7 @@ class ConfigurationTest < Test::Unit::TestCase
concurrency 2
iterations 1
get "http://google.com/"
+ post "http://google.com/", {:q => "something"}
end
end
@@ -19,15 +20,20 @@ class ConfigurationTest < Test::Unit::TestCase
end
should "add get requests to an array of pages" do
- assert_equal 1, @config.pages.length
assert_equal Trample::Page.new(:get, "http://google.com/"), @config.pages.first
end
+ should "add post requests to the array of pages, including their params" do
+ expected = Trample::Page.new(:post, "http://google.com/", {:q => "something"})
+ assert_equal expected, @config.pages.last
+ end
+
should "be equal if all the objects are the same" do
identical_config = Trample::Configuration.new do
concurrency 2
iterations 1
get "http://google.com/"
+ post "http://google.com/", {:q => "something"}
end
assert_equal identical_config, @config
end

0 comments on commit 711f099

Please sign in to comment.