diff options
author | Bob Remeika <bob.remeika@gmail.com> | 2009-09-23 01:05:45 -0700 |
---|---|---|
committer | Stefan Penner <stefan.penner@gmail.com> | 2010-01-27 12:44:30 -0600 |
commit | 773c4929fda3eff30e096813d25a61802638ab65 (patch) | |
tree | 96b7f151f90687b344dd8844fa8aea634fbfafd5 /actionpack/test | |
parent | 23275d1b793c21ea9481383402a881c177e8111c (diff) | |
download | rails-773c4929fda3eff30e096813d25a61802638ab65.tar.gz rails-773c4929fda3eff30e096813d25a61802638ab65.tar.bz2 rails-773c4929fda3eff30e096813d25a61802638ab65.zip |
Implemented a fuller stub in AjaxTestCase for url_for because link_to calls url_for on all urls passed to it. Tests that were testing different input types for the url were failing because of this.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/ajax_test.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/actionpack/test/template/ajax_test.rb b/actionpack/test/template/ajax_test.rb index 86932d754f..8770401b96 100644 --- a/actionpack/test/template/ajax_test.rb +++ b/actionpack/test/template/ajax_test.rb @@ -54,7 +54,7 @@ class LinkToRemoteTest < AjaxTestCase end test "with no update" do - assert_html link, %w(href="/blog/destroy/3" Delete\ this\ post data-remote="true") + assert_html link, %w(href="/blog/destroy/4" Delete\ this\ post data-remote="true") end test "with :html options" do @@ -102,10 +102,17 @@ class ButtonToRemoteTest < AjaxTestCase button_to_remote("Remote outpost", options, html) end + def url_for(*) + "/whatnot" + end + class StandardTest < ButtonToRemoteTest test "basic" do - assert_html button({:url => {:action => "whatnot"}}, {:class => "fine"}), - %w(input class="fine" type="button" value="Remote outpost" data-url="/url/hash") + button = button({:url => {:action => "whatnot"}}, {:class => "fine"}) + [/input/, /class="fine"/, /type="button"/, /value="Remote outpost"/, + /data-url="\/whatnot"/].each do |match| + assert_match(match, button) + end end end |