Sha256: 838b63155efcbb5ec72c024420c063a1cb5ec7b55df9c055f984fe43fe1f0f09

Contents?: true

Size: 1.19 KB

Versions: 57

Compression:

Stored size: 1.19 KB

Contents

require 'bundler/setup'
require 'html/pipeline'
require 'test/unit'

require 'active_support/core_ext/object/try'

module TestHelpers
  # Asserts that `needle` is not a member of `haystack`, where
  # `haystack` is any object that responds to `include?`.
  def assert_doesnt_include(needle, haystack, message = nil)
    error = '<?> included in <?>'
    message = build_message(message, error, needle.to_s, Array(haystack).map(&:to_s))

    assert_block message do
      !haystack.include?(needle)
    end
  end

  # Asserts that `needle` is a member of `haystack`, where
  # `haystack` is any object that responds to `include?`.
  def assert_includes(needle, haystack, message = nil)
    error = '<?> not included in <?>'
    message = build_message(message, error, needle.to_s, Array(haystack).map(&:to_s))

    assert_block message do
      haystack.include?(needle)
    end
  end

  # Asserts that two html fragments are equivalent. Attribute order
  # will be ignored.
  def assert_equal_html(expected, actual)
    assert_equal Nokogiri::HTML::DocumentFragment.parse(expected).to_hash,
                 Nokogiri::HTML::DocumentFragment.parse(actual).to_hash
  end
end

Test::Unit::TestCase.send(:include, TestHelpers)

Version data entries

57 entries across 57 versions & 4 rubygems

Version Path
html-pipeline-linuxfr-0.15.7 test/test_helper.rb
html-pipeline-linuxfr-0.15.6 test/test_helper.rb
html-pipeline-linuxfr-0.15.5 test/test_helper.rb
html-pipeline-linuxfr-0.15.4 test/test_helper.rb
html-pipeline-linuxfr-0.15.3 test/test_helper.rb
html-pipeline-linuxfr-0.14.30 test/test_helper.rb
html-pipeline-linuxfr-0.15.2 test/test_helper.rb
html-pipeline-linuxfr-0.15.1 test/test_helper.rb
html-pipeline-linuxfr-0.14.29 test/test_helper.rb
html-pipeline-linuxfr-0.15.0 test/test_helper.rb
html-pipeline-linuxfr-0.14.28 test/test_helper.rb
html-pipeline-linuxfr-0.14.27 test/test_helper.rb
html-pipeline-linuxfr-0.14.26 test/test_helper.rb
html-pipeline-linuxfr-0.14.25 test/test_helper.rb
html-pipeline-linuxfr-0.14.24 test/test_helper.rb
html-pipeline-linuxfr-0.14.23 test/test_helper.rb
html-pipeline-linuxfr-0.14.22 test/test_helper.rb
html-pipeline-linuxfr-0.14.21 test/test_helper.rb
html-pipeline-linuxfr-0.14.20 test/test_helper.rb
html-pipeline-linuxfr-0.14.19 test/test_helper.rb