Sha256: 7ab794f0d87df718b4db9a9f3b1909f5a85142a11217e60c32e0959bd62eae6a

Contents?: true

Size: 1.27 KB

Versions: 51

Compression:

Stored size: 1.27 KB

Contents

require 'test_helper'
require 'rails/dom/testing/assertions/dom_assertions'

class DomAssertionsTest < ActiveSupport::TestCase
  Assertion = Minitest::Assertion

  include Rails::Dom::Testing::Assertions::DomAssertions

  def test_responds_to_assert_dom_equal
    assert respond_to?(:assert_dom_equal)
  end

  def test_dom_equal
    html = '<a></a>'
    assert_dom_equal(html, html.dup)
  end

  def test_equal_doms_with_different_order_attributes
    attributes = %{<a b="hello" c="hello"></a>}
    reverse_attributes = %{<a c="hello" b="hello"></a>}
    assert_dom_equal(attributes, reverse_attributes)
  end

  def test_dom_not_equal
    assert_dom_not_equal('<a></a>', '<b></b>')
  end

  def test_unequal_doms_attributes_with_different_order_and_values
    attributes = %{<a b="hello" c="hello"></a>}
    reverse_attributes = %{<a c="hello" b="goodbye"></a>}
    assert_dom_not_equal(attributes, reverse_attributes)
  end

  def test_custom_message_is_used_in_failures
    message = "This is my message."

    e = assert_raises(Assertion) do
      assert_dom_equal('<a></a>', '<b></b>', message)
    end

    assert_equal e.message, message
  end

  def test_unequal_dom_attributes_in_children
    assert_dom_not_equal(
      %{<a><b c="1" /></a>},
      %{<a><b c="2" /></a>}
    )
  end
end

Version data entries

51 entries across 50 versions & 17 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
spiral_form-0.1.1 vendor/bundle/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
spiral_form-0.1.0 vendor/bundle/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/rails-dom-testing-2.0.3/test/dom_assertions_test.rb