Methods
- F
- H
- P
- R
- T
-
- test_button_to_enabled_disabled,
- test_button_to_with_block,
- test_button_to_with_form_class,
- test_button_to_with_form_class_escapes,
- test_button_to_with_html_safe_URL,
- test_button_to_with_javascript_confirm,
- test_button_to_with_javascript_disable_with,
- test_button_to_with_method_delete,
- test_button_to_with_method_get,
- test_button_to_with_params,
- test_button_to_with_path,
- test_button_to_with_query,
- test_button_to_with_query_and_no_name,
- test_button_to_with_remote_and_form_options,
- test_button_to_with_remote_and_javascript_confirm,
- test_button_to_with_remote_and_javascript_disable_with,
- test_button_to_with_remote_false,
- test_button_to_with_straight_url,
- test_button_to_with_straight_url_and_request_forgery,
- test_current_page_ignoring_params,
- test_current_page_with_double_escaped_params,
- test_current_page_with_escaped_params,
- test_current_page_with_escaped_params_with_different_encoding,
- test_current_page_with_http_head_method,
- test_current_page_with_not_get_verb,
- test_current_page_with_params_that_match,
- test_current_page_with_simple_url,
- test_link_tag_does_not_escape_html_safe_content,
- test_link_tag_escapes_content,
- test_link_tag_using_block_and_hash,
- test_link_tag_using_block_in_erb,
- test_link_tag_using_delete_javascript,
- test_link_tag_using_delete_javascript_and_href,
- test_link_tag_using_delete_javascript_and_href_and_confirm,
- test_link_tag_using_post_javascript,
- test_link_tag_using_post_javascript_and_confirm,
- test_link_tag_using_post_javascript_and_rel,
- test_link_tag_with_back,
- test_link_tag_with_back_and_no_referer,
- test_link_tag_with_block,
- test_link_tag_with_block_and_html_options,
- test_link_tag_with_custom_onclick,
- test_link_tag_with_host_option,
- test_link_tag_with_html_safe_string,
- test_link_tag_with_img,
- test_link_tag_with_javascript_confirm,
- test_link_tag_with_query,
- test_link_tag_with_query_and_no_name,
- test_link_tag_with_straight_url,
- test_link_tag_without_host_option,
- test_link_to_if,
- test_link_to_if_with_block,
- test_link_to_unless,
- test_link_to_unless_with_block,
- test_link_to_with_remote,
- test_link_to_with_remote_false,
- test_link_to_with_string_remote_in_non_html_options,
- test_link_to_with_symbolic_remote_in_non_html_options,
- test_link_unless_current,
- test_link_with_nil_html_options,
- test_mail_to,
- test_mail_to_does_not_modify_html_options_hash,
- test_mail_to_returns_html_safe_string,
- test_mail_to_with_block,
- test_mail_to_with_block_and_options,
- test_mail_to_with_html_safe_string,
- test_mail_to_with_img,
- test_mail_to_with_nil,
- test_mail_to_with_special_characters,
- test_mail_with_options,
- test_url_for_does_not_escape_urls,
- test_url_for_with_back,
- test_url_for_with_back_and_no_referer
- U
Included Modules
- ActionView::Helpers::UrlHelper
- ActionView::Helpers::JavaScriptHelper
- Rails::Dom::Testing::Assertions::DomAssertions
- ActionView::Context
- RenderERBUtils
Attributes
| [RW] | controller | In a few cases, the helper proxies to 'controller' or request. In those cases, we'll set up a simple mock |
| [RW] | request | In a few cases, the helper proxies to 'controller' or request. In those cases, we'll set up a simple mock |
Instance Public methods
form_authenticity_token()
Link
protect_against_forgery?()
Link
request_for_url(url, opts = {})
Link
request_forgery_protection_token()
Link
test_current_page_ignoring_params()
Link
test_current_page_with_double_escaped_params()
Link
# File actionview/test/template/url_helper_test.rb, line 438 def test_current_page_with_double_escaped_params @request = request_for_url("/category/administra%c3%a7%c3%a3o?callback_url=http%3a%2f%2fexample.com%2ffoo") assert current_page?(controller: 'foo', action: 'category', category: 'administração', callback_url: 'http://example.com/foo') end
test_current_page_with_escaped_params()
Link
test_current_page_with_escaped_params_with_different_encoding()
Link
# File actionview/test/template/url_helper_test.rb, line 430 def test_current_page_with_escaped_params_with_different_encoding @request = request_for_url("/") @request.stub(:path, "/category/administra%c3%a7%c3%a3o".force_encoding(Encoding::ASCII_8BIT)) do assert current_page?(:controller => 'foo', :action => 'category', category: 'administração') assert current_page?("http://www.example.com/category/administra%c3%a7%c3%a3o") end end
test_current_page_with_http_head_method()
Link
test_current_page_with_not_get_verb()
Link
test_current_page_with_params_that_match()
Link
# File actionview/test/template/url_helper_test.rb, line 411 def test_current_page_with_params_that_match @request = request_for_url("/?order=desc&page=1") assert current_page?(hash_for(order: "desc", page: "1")) assert current_page?("http://www.example.com/?order=desc&page=1") end
test_current_page_with_simple_url()
Link
test_link_tag_does_not_escape_html_safe_content()
Link
test_link_tag_escapes_content()
Link
test_link_tag_using_block_and_hash()
Link
test_link_tag_using_block_in_erb()
Link
test_link_tag_using_delete_javascript()
Link
test_link_tag_using_delete_javascript_and_href()
Link
test_link_tag_using_delete_javascript_and_href_and_confirm()
Link
# File actionview/test/template/url_helper_test.rb, line 309 def test_link_tag_using_delete_javascript_and_href_and_confirm assert_dom_equal( %Q{<a href="\#" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>}, link_to("Destroy", "http://www.example.com", method: :delete, href: '#', data: { confirm: "Are you serious?" }) ) end
test_link_tag_using_post_javascript()
Link
test_link_tag_using_post_javascript_and_confirm()
Link
# File actionview/test/template/url_helper_test.rb, line 302 def test_link_tag_using_post_javascript_and_confirm assert_dom_equal( %Q{<a href="http://www.example.com" data-method="post" rel="nofollow" data-confirm="Are you serious?">Hello</a>}, link_to("Hello", "http://www.example.com", method: :post, data: { confirm: "Are you serious?" }) ) end
test_link_tag_using_post_javascript_and_rel()
Link
# File actionview/test/template/url_helper_test.rb, line 295 def test_link_tag_using_post_javascript_and_rel assert_dom_equal( %Q{<a href="http://www.example.com" data-method="post" rel="example nofollow">Hello</a>}, link_to("Hello", "http://www.example.com", method: :post, rel: 'example') ) end
test_link_tag_with_back()
Link
# File actionview/test/template/url_helper_test.rb, line 201 def test_link_tag_with_back env = {"HTTP_REFERER" => "http://www.example.com/referer"} @controller = Struct.new(:request).new(Struct.new(:env).new(env)) expected = %Q{<a href="#{env["HTTP_REFERER"]}">go back</a>} assert_dom_equal expected, link_to('go back', :back) end
test_link_tag_with_back_and_no_referer()
Link
# File actionview/test/template/url_helper_test.rb, line 208 def test_link_tag_with_back_and_no_referer @controller = Struct.new(:request).new(Struct.new(:env).new({})) link = link_to('go back', :back) assert_dom_equal %Q{<a href="javascript:history.back()">go back</a>}, link end
test_link_tag_with_block()
Link
test_link_tag_with_block_and_html_options()
Link
test_link_tag_with_custom_onclick()
Link
# File actionview/test/template/url_helper_test.rb, line 225 def test_link_tag_with_custom_onclick link = link_to("Hello", "http://www.example.com", onclick: "alert('yay!')") expected = %Q{<a href="http://www.example.com" onclick="alert('yay!')">Hello</a>} assert_dom_equal expected, link end
test_link_tag_with_host_option()
Link
test_link_tag_with_html_safe_string()
Link
test_link_tag_with_img()
Link
test_link_tag_with_javascript_confirm()
Link
# File actionview/test/template/url_helper_test.rb, line 231 def test_link_tag_with_javascript_confirm assert_dom_equal( %Q{<a href="http://www.example.com" data-confirm="Are you sure?">Hello</a>}, link_to("Hello", "http://www.example.com", data: { confirm: "Are you sure?" }) ) assert_dom_equal( %Q{<a href="http://www.example.com" data-confirm="You cant possibly be sure, can you?">Hello</a>}, link_to("Hello", "http://www.example.com", data: { confirm: "You cant possibly be sure, can you?" }) ) assert_dom_equal( %Q{<a href="http://www.example.com" data-confirm="You cant possibly be sure,\n can you?">Hello</a>}, link_to("Hello", "http://www.example.com", data: { confirm: "You cant possibly be sure,\n can you?" }) ) end
test_link_tag_with_query()
Link
test_link_tag_with_query_and_no_name()
Link
# File actionview/test/template/url_helper_test.rb, line 196 def test_link_tag_with_query_and_no_name expected = %Q{<a href="http://www.example.com?q1=v1&q2=v2">http://www.example.com?q1=v1&q2=v2</a>} assert_dom_equal expected, link_to(nil, "http://www.example.com?q1=v1&q2=v2") end
test_link_tag_with_straight_url()
Link
test_link_tag_without_host_option()
Link
test_link_to_if()
Link
test_link_to_if_with_block()
Link
test_link_to_unless()
Link
# File actionview/test/template/url_helper_test.rb, line 355 def test_link_to_unless assert_equal "Showing", link_to_unless(true, "Showing", url_hash) assert_dom_equal %Q{<a href="/">Listing</a>}, link_to_unless(false, "Listing", url_hash) assert_equal "<strong>Showing</strong>", link_to_unless(true, "Showing", url_hash) { |name| "<strong>#{name}</strong>".html_safe } assert_equal "test", link_to_unless(true, "Showing", url_hash) { "test" } assert_equal %Q{<b>Showing</b>}, link_to_unless(true, "<b>Showing</b>", url_hash) assert_equal %Q{<a href="/"><b>Showing</b></a>}, link_to_unless(false, "<b>Showing</b>", url_hash) assert_equal %Q{<b>Showing</b>}, link_to_unless(true, "<b>Showing</b>".html_safe, url_hash) assert_equal %Q{<a href="/"><b>Showing</b></a>}, link_to_unless(false, "<b>Showing</b>".html_safe, url_hash) end
test_link_to_unless_with_block()
Link
# File actionview/test/template/url_helper_test.rb, line 487 def test_link_to_unless_with_block assert_equal %Q{<a href="/">Showing</a>}, link_to_unless(false, "Showing", url_hash) { "Fallback" } assert_dom_equal "Fallback", link_to_unless(true, "Listing", url_hash) { "Fallback" } end
test_link_to_with_remote()
Link
test_link_to_with_remote_false()
Link
test_link_to_with_string_remote_in_non_html_options()
Link
test_link_to_with_symbolic_remote_in_non_html_options()
Link
test_link_unless_current()
Link
# File actionview/test/template/url_helper_test.rb, line 444 def test_link_unless_current @request = request_for_url("/") assert_equal "Showing", link_to_unless_current("Showing", url_hash) assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/") @request = request_for_url("/?order=desc") assert_equal "Showing", link_to_unless_current("Showing", url_hash) assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/") @request = request_for_url("/?order=desc&page=1") assert_equal "Showing", link_to_unless_current("Showing", hash_for(order: 'desc', page: '1')) assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/?order=desc&page=1") @request = request_for_url("/?order=desc") assert_equal %Q{<a href="/?order=asc">Showing</a>}, link_to_unless_current("Showing", hash_for(order: :asc)) assert_equal %Q{<a href="http://www.example.com/?order=asc">Showing</a>}, link_to_unless_current("Showing", "http://www.example.com/?order=asc") @request = request_for_url("/?order=desc") assert_equal %Q{<a href="/?order=desc&page=2\">Showing</a>}, link_to_unless_current("Showing", hash_for(order: "desc", page: 2)) assert_equal %Q{<a href="http://www.example.com/?order=desc&page=2">Showing</a>}, link_to_unless_current("Showing", "http://www.example.com/?order=desc&page=2") @request = request_for_url("/show") assert_equal %Q{<a href="/">Listing</a>}, link_to_unless_current("Listing", url_hash) assert_equal %Q{<a href="http://www.example.com/">Listing</a>}, link_to_unless_current("Listing", "http://www.example.com/") end
test_link_with_nil_html_options()
Link
test_mail_to()
Link
# File actionview/test/template/url_helper_test.rb, line 492 def test_mail_to assert_dom_equal %Q{<a href="mailto:david@loudthinking.com">david@loudthinking.com</a>}, mail_to("david@loudthinking.com") assert_dom_equal %Q{<a href="mailto:david@loudthinking.com">David Heinemeier Hansson</a>}, mail_to("david@loudthinking.com", "David Heinemeier Hansson") assert_dom_equal( %Q{<a class="admin" href="mailto:david@loudthinking.com">David Heinemeier Hansson</a>}, mail_to("david@loudthinking.com", "David Heinemeier Hansson", "class" => "admin") ) assert_equal mail_to("david@loudthinking.com", "David Heinemeier Hansson", "class" => "admin"), mail_to("david@loudthinking.com", "David Heinemeier Hansson", class: "admin") end
test_mail_to_does_not_modify_html_options_hash()
Link
test_mail_to_returns_html_safe_string()
Link
test_mail_to_with_block()
Link
test_mail_to_with_block_and_options()
Link
# File actionview/test/template/url_helper_test.rb, line 552 def test_mail_to_with_block_and_options assert_dom_equal %Q{<a class="special" href="mailto:me@example.com?cc=ccaddress%40example.com"><span>Email me</span></a>}, mail_to('me@example.com', cc: "ccaddress@example.com", class: "special") { content_tag(:span, 'Email me') } end
test_mail_to_with_html_safe_string()
Link
test_mail_to_with_img()
Link
test_mail_to_with_nil()
Link
test_mail_to_with_special_characters()
Link
# File actionview/test/template/url_helper_test.rb, line 503 def test_mail_to_with_special_characters assert_dom_equal( %Q{<a href="mailto:%23%21%24%25%26%27%2A%2B-%2F%3D%3F%5E_%60%7B%7D%7C%7E@example.org">#!$%&'*+-/=?^_`{}|~@example.org</a>}, mail_to("#!$%&'*+-/=?^_`{}|~@example.org") ) end
test_mail_with_options()
Link
# File actionview/test/template/url_helper_test.rb, line 510 def test_mail_with_options assert_dom_equal( %Q{<a href="mailto:me@example.com?cc=ccaddress%40example.com&bcc=bccaddress%40example.com&body=This%20is%20the%20body%20of%20the%20message.&subject=This%20is%20an%20example%20email">My email</a>}, mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.") ) end
test_url_for_does_not_escape_urls()
Link
test_url_for_with_back()
Link
# File actionview/test/template/url_helper_test.rb, line 42 def test_url_for_with_back referer = 'http://www.example.com/referer' @controller = Struct.new(:request).new(Struct.new(:env).new("HTTP_REFERER" => referer)) assert_equal 'http://www.example.com/referer', url_for(:back) end
test_url_for_with_back_and_no_referer()
Link