Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Commit

Permalink
Merge 83c8f53 into d91d5c2
Browse files Browse the repository at this point in the history
  • Loading branch information
sanemat committed Jan 8, 2017
2 parents d91d5c2 + 83c8f53 commit 8228c99
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
6 changes: 6 additions & 0 deletions gemfiles/rails_4_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ gem "actionview", "~> 4.2.0"
gem "actionpack", "~> 4.2.0"
gem "activesupport", "~> 4.2.0"
gem "rails-dom-testing"
platforms :ruby do
if RUBY_VERSION > "2.1.0"
else
gem 'nokogiri', '1.6.8.1'
end
end

gemspec :path => "../"
23 changes: 13 additions & 10 deletions test/test_actionview-link_to_blank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,18 @@ def test_link_unless_current
end

private
# MiniTest does not have build_message method, so I copy from below:
# https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/assertions/dom.rb
# Test::Unit
# http://doc.ruby-lang.org/ja/1.9.3/method/Test=3a=3aUnit=3a=3aAssertions/i/build_message.html
# Test::Unit (based on MiniTest)
# http://www.ruby-doc.org/stdlib-2.0/libdoc/test/unit/rdoc/Test/Unit/Assertions.html#method-i-message
def assert_dom_equal(expected, actual, message = "")
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
assert_equal expected_dom, actual_dom

if Gem::Version.new(ActionPack::VERSION::STRING) < Gem::Version.new("4")
# MiniTest does not have build_message method, so I copy from below:
# https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/assertions/dom.rb
# Test::Unit
# http://doc.ruby-lang.org/ja/1.9.3/method/Test=3a=3aUnit=3a=3aAssertions/i/build_message.html
# Test::Unit (based on MiniTest)
# http://www.ruby-doc.org/stdlib-2.0/libdoc/test/unit/rdoc/Test/Unit/Assertions.html#method-i-message
def assert_dom_equal(expected, actual, message = "")
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
assert_equal expected_dom, actual_dom
end
end
end

0 comments on commit 8228c99

Please sign in to comment.