Methods
D
I
S
T
Instance Public methods
decrement()
# File activesupport/test/test_case_test.rb, line 11
def decrement
  self.num -= 1
end
increment()
# File activesupport/test/test_case_test.rb, line 7
def increment
  self.num += 1
end
setup()
# File activesupport/test/test_case_test.rb, line 4
def setup
  @object = Class.new do
    attr_accessor :num
    def increment
      self.num += 1
    end

    def decrement
      self.num -= 1
    end
  end.new
  @object.num = 0
end
test_arbitrary_expression()
# File activesupport/test/test_case_test.rb, line 73
def test_arbitrary_expression
  assert_difference '@object.num + 1', +2 do
    @object.increment
    @object.increment
  end
end
test_array_of_expressions()
# File activesupport/test/test_case_test.rb, line 93
def test_array_of_expressions
  assert_difference [ '@object.num', '@object.num + 1' ], +1 do
    @object.increment
  end
end
test_array_of_expressions_identify_failure()
# File activesupport/test/test_case_test.rb, line 99
def test_array_of_expressions_identify_failure
  assert_raises(Minitest::Assertion) do
    assert_difference ['@object.num', '1 + 1'] do
      @object.increment
    end
  end
end
test_array_of_expressions_identify_failure_when_message_provided()
# File activesupport/test/test_case_test.rb, line 107
def test_array_of_expressions_identify_failure_when_message_provided
  assert_raises(Minitest::Assertion) do
    assert_difference ['@object.num', '1 + 1'], 1, 'something went wrong' do
      @object.increment
    end
  end
end
test_assert_difference()
# File activesupport/test/test_case_test.rb, line 53
def test_assert_difference
  assert_difference '@object.num', +1 do
    @object.increment
  end
end
test_assert_difference_retval()
# File activesupport/test/test_case_test.rb, line 59
def test_assert_difference_retval
  incremented = assert_difference '@object.num', +1 do
    @object.increment
  end

  assert_equal incremented, 1
end
test_assert_difference_with_implicit_difference()
# File activesupport/test/test_case_test.rb, line 67
def test_assert_difference_with_implicit_difference
  assert_difference '@object.num' do
    @object.increment
  end
end
test_assert_no_difference_fail()
# File activesupport/test/test_case_test.rb, line 35
def test_assert_no_difference_fail
  error = assert_raises(Minitest::Assertion) do
    assert_no_difference '@object.num' do
      @object.increment
    end
  end
  assert_equal "\"@object.num\" didn't change by 0.\nExpected: 0\n  Actual: 1", error.message
end
test_assert_no_difference_pass()
# File activesupport/test/test_case_test.rb, line 29
def test_assert_no_difference_pass
  assert_no_difference '@object.num' do
    # ...
  end
end
test_assert_no_difference_with_message_fail()
# File activesupport/test/test_case_test.rb, line 44
def test_assert_no_difference_with_message_fail
  error = assert_raises(Minitest::Assertion) do
    assert_no_difference '@object.num', 'Object Changed' do
      @object.increment
    end
  end
  assert_equal "Object Changed.\n\"@object.num\" didn't change by 0.\nExpected: 0\n  Actual: 1", error.message
end
test_assert_not()
# File activesupport/test/test_case_test.rb, line 18
def test_assert_not
  assert_equal true, assert_not(nil)
  assert_equal true, assert_not(false)

  e = assert_raises(Minitest::Assertion) { assert_not true }
  assert_equal 'Expected true to be nil or false', e.message

  e = assert_raises(Minitest::Assertion) { assert_not true, 'custom' }
  assert_equal 'custom', e.message
end
test_expression_is_evaluated_in_the_appropriate_scope()
# File activesupport/test/test_case_test.rb, line 86
def test_expression_is_evaluated_in_the_appropriate_scope
  silence_warnings do
    local_scope = local_scope = 'foo'
    assert_difference('local_scope; @object.num') { @object.increment }
  end
end
test_negative_differences()
# File activesupport/test/test_case_test.rb, line 80
def test_negative_differences
  assert_difference '@object.num', -1 do
    @object.decrement
  end
end