Permalink
Browse files

add parameters to page

  • Loading branch information...
1 parent b1a3cb2 commit 1e2e041ccd43b1c3a0cf587566ac16fe1f1cb13c @jamesgolick committed May 1, 2009
Showing with 8 additions and 3 deletions.
  1. +3 −2 lib/trample/page.rb
  2. +5 −1 test/page_test.rb
View
@@ -1,10 +1,11 @@
module Trample
class Page
- attr_reader :request_method, :url
+ attr_reader :request_method, :url, :parameters
- def initialize(request_method, url)
+ def initialize(request_method, url, parameters = {})
@request_method = request_method
@url = url
+ @parameters = parameters
end
def ==(other)
View
@@ -3,7 +3,7 @@
class PageTest < Test::Unit::TestCase
context "A page" do
setup do
- @page = Trample::Page.new(:get, "http://google.com/")
+ @page = Trample::Page.new(:get, "http://google.com/", :username => "joetheuser")
end
should "have a request_method" do
@@ -14,6 +14,10 @@ class PageTest < Test::Unit::TestCase
assert_equal "http://google.com/", @page.url
end
+ should "have request parameters" do
+ assert_equal({:username => "joetheuser"}, @page.parameters)
+ end
+
should "be equal with the same request_method and url" do
assert_equal Trample::Page.new(:get, "http://google.com"), Trample::Page.new(:get, "http://google.com")
end

0 comments on commit 1e2e041

Please sign in to comment.