Sha256: 3de578fdac6950f0d8a3e414e3047b822847163c982b264f6723179164f3d14f

Contents?: true

Size: 1.11 KB

Versions: 15

Compression:

Stored size: 1.11 KB

Contents

require 'assert'

class Assert::Assertions::AssertNotEqualTest < Assert::Context
  desc "the assert_not_equal helper run in a test"
  setup do
    fail_desc = @fail_desc = "assert not equal fail desc"
    fail_args = @fail_args = [ 1, 1, fail_desc ]
    @test = Factory.test do
      assert_not_equal(*fail_args)  # fail
      assert_not_equal(1, 2)  # pass
    end
    @test.run
  end
  subject{ @test }

  should "have 2 total results" do
    assert_equal 2, subject.result_count
  end
  should "have 1 pass result" do
    assert_equal 1, subject.result_count(:pass)
  end
  should "have 1 fail result" do
    assert_equal 1, subject.result_count(:fail)
  end

  class FailMessageTest < AssertNotEqualTest
    desc "with a failed result"
    setup do
      @expected = [
        @fail_args[2],
        "#{@fail_args[0]} not expected to be equal to #{@fail_args[1]}.",
      ].join("\n")
      @fail_message = @test.fail_results.first.message
    end
    subject{ @fail_message }

    should "have a fail message with an explanation of what failed and my fail description" do
      assert_equal @expected, subject
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
assert-2.0.0.rc.1 test/assertions/assert_not_equal_test.rb
assert-1.1.0 test/assertions/assert_not_equal_test.rb
assert-1.0.0 test/assertions/assert_not_equal_test.rb
assert-0.8.1 test/assertions/assert_not_equal_test.rb
assert-0.8.0 test/assertions/assert_not_equal_test.rb
assert-0.7.3 test/assertions/assert_not_equal_test.rb
assert-0.7.2 test/assertions/assert_not_equal_test.rb
assert-0.7.1 test/assertions/assert_not_equal_test.rb
assert-0.7.0 test/assertions/assert_not_equal_test.rb
assert-0.6.0 test/assertions/assert_not_equal_test.rb
assert-0.5.0 test/assertions/assert_not_equal_test.rb
assert-0.4.0 test/assertions/assert_not_equal_test.rb
assert-0.3.0 test/assertions/assert_not_equal_test.rb
assert-0.2.1 test/assertions/assert_not_equal_test.rb
assert-0.2.0 test/assertions/assert_not_equal_test.rb