Permalink
Browse files

make sure GETs can have config parameters

  • Loading branch information...
1 parent 1f14e0e commit 5c9fadd7d68cbcd0c565d0986d8ff19f40a4f5ed @jamesgolick committed Jun 4, 2009
Showing with 9 additions and 3 deletions.
  1. +2 −2 lib/trample/configuration.rb
  2. +7 −1 test/configuration_test.rb
@@ -17,8 +17,8 @@ def iterations(*value)
@iterations
end
- def get(url)
- @pages << Page.new(:get, url)
+ def get(url, &block)
+ @pages << Page.new(:get, url, block || {})
end
def post(url, params = nil, &block)
@@ -7,7 +7,9 @@ class ConfigurationTest < Test::Unit::TestCase
@config = Trample::Configuration.new do
concurrency 2
iterations 1
- get "http://google.com/"
+ get "http://google.com/" do
+ {:a => 'b'}
+ end
post "http://google.com/", {:q => "something"}
post "http://google.com/", &@params_proc
login do
@@ -30,6 +32,10 @@ class ConfigurationTest < Test::Unit::TestCase
assert_equal Trample::Page.new(:get, "http://google.com/"), @config.pages.first
end
+ should "add get params to the array of pages" do
+ assert_equal({:a => "b"}, @config.pages.first.parameters)
+ 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[1]

0 comments on commit 5c9fadd

Please sign in to comment.