Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make sure to provide different parameters each time

  • Loading branch information...
commit 854f3cb34311e2a8e9a67719f278ce09dc0a1f8a 1 parent 51c9502
@jamesgolick authored
Showing with 6 additions and 1 deletion.
  1. +1 −1  lib/trample/page.rb
  2. +5 −0 test/page_test.rb
View
2  lib/trample/page.rb
@@ -29,7 +29,7 @@ def proc_params?
def interpolated_url
params = parameters # cache called proc
- url = @url
+ url = @url.dup
url.scan(/\:\w+/).each do |m|
url.gsub!(m, params[m.gsub(/:/, '').to_sym].to_s)
end
View
5 test/page_test.rb
@@ -49,6 +49,11 @@ class PageTest < Test::Unit::TestCase
should "interpolate those parameters with the url string" do
assert_equal "http://mysite.com/somethings/5", @page.url
end
+
+ should "interpolate a different parameter each time" do
+ page = Trample::Page.new(:get, "http://mysite.com/somethings/:id", lambda { {:id => rand(10)} })
+ assert_not_equal page.url, page.url
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.