Sha256: 378854b6840154b7c63b83b9e503d7b0a81759006fed5040a8b2900e1322e100
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
require 'bundler/setup' require 'minitest/autorun' require 'uri' require 'action_view' require 'active_link_to' class MiniTest::Test # need this to simulate requests that drive active_link_helper module FakeRequest class Request attr_accessor :original_fullpath end def request @request ||= Request.new end def params @params ||= {} end end ActiveLinkTo.send :include, FakeRequest include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper include ActiveLinkTo def set_path(path, purge_cache = true) request.original_fullpath = path if purge_cache && defined?(@is_active_link) remove_instance_variable(:@is_active_link) end end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_link_to-1.0.5 | test/test_helper.rb |
active_link_to-1.0.4 | test/test_helper.rb |