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.14.3 test/test_helper.rb
html-pipeline-linuxfr-0.14.2 test/test_helper.rb
html-pipeline-linuxfr-0.14.1 test/test_helper.rb
html-pipeline-linuxfr-0.14.0 test/test_helper.rb
html-pipeline-linuxfr-0.0.14 test/test_helper.rb
html-pipeline-0.0.14 test/test_helper.rb
html-pipeline-0.0.13 test/test_helper.rb
geothird-html-pipeline-0.0.12 test/test_helper.rb
html-pipeline-0.0.12 test/test_helper.rb
html-pipeline-0.0.11 test/test_helper.rb
html-pipeline-0.0.10 test/test_helper.rb
html-pipeline-0.0.8 test/test_helper.rb
html-pipeline-0.0.7 test/test_helper.rb
html-pipeline-no-charlock-0.0.6 test/test_helper.rb
html-pipeline-0.0.6 test/test_helper.rb
html-pipeline-0.0.5 test/test_helper.rb
html-pipeline-0.0.4 test/test_helper.rb