Sha256: 7a14ab5eb866d017525867dba4010b821aef7cb54baea587182f60c95e58d695

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

require 'rubygems'
require 'minitest/autorun'
require 'uri'
require 'action_view'

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'active_link_to'

# need this to simulate requests that drive active_link_helper
module FakeRequest
  class Request
    attr_accessor :fullpath
  end
  def request
    @request ||= Request.new
  end
  def params
    @params ||= {}
  end
end

ActiveLinkTo.send :include, FakeRequest

class MiniTest::Test

  include ActionView::Helpers::UrlHelper
  include ActionView::Helpers::TagHelper
  include ActiveLinkTo

  def assert_html(html, selector, value = nil)
    doc = Nokogiri::HTML(html)
    element = doc.at_css(selector)
    assert element, "No element found at: `#{selector}`"
    assert_equal value, element.text if value
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_link_to-1.0.3 test/test_helper.rb