# encoding: utf-8 require "minitest/autorun" require "rails" require "rails_autolink/helpers" require 'erb' require 'cgi' require 'active_support/core_ext/class/attribute_accessors' require 'action_pack' require 'action_view/helpers/capture_helper' require 'action_view/helpers/sanitize_helper' require 'action_view/helpers/url_helper' require 'action_view/helpers/tag_helper' require 'active_support/core_ext/module/attribute_accessors' require 'active_support/core_ext/string/encoding' require 'action_dispatch/testing/assertions' require 'action_view/helpers/text_helper' require 'action_view/helpers/output_safety_helper' class TestRailsAutolink < MiniTest::Unit::TestCase include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TextHelper include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::OutputSafetyHelper include ActionDispatch::Assertions::DomAssertions def test_loco t = "OOOOOOOOOOOOOOOOOOOOOOO

textileRuby\n

otro link: www.hola.com" assert_equal "loco", auto_link(t, :link=> 'urls', :sanitize_options => {:attributes => ["target", "class"], :tags=>[]}, :html=> {:target => '_blank', :mememe=> 'MEM'}) end private def generate_result(link_text, href = nil, escape = false) href ||= link_text if escape %{#{CGI::escapeHTML link_text}} else %{#{link_text}} end end # from ruby core def build_message(head, template=nil, *arguments) template &&= template.chomp template.gsub(/\?/) { mu_pp(arguments.shift) } end # Temporarily replaces KCODE for the block def with_kcode(kcode) if RUBY_VERSION < '1.9' old_kcode, $KCODE = $KCODE, kcode begin yield ensure $KCODE = old_kcode end else yield end end end