Sha256: f1b3117e8139bc750274ccd9f8c04d3b4fc7f4876de30383df975a071d50f7bd

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

class Test::Unit::TestCase
  
  # http://project.ioni.st/post/217#post-217
  #
  #  def test_new_publication
  #    assert_difference(Publication, :count) do
  #      post :create, :publication => {...}
  #      # ...
  #    end
  #  end
  #
  # modified by mabs29 to include arguments
  def assert_difference(object, method = nil, difference = 1, *args)
    initial_value = object.send(method, *args)
    yield
    assert_equal initial_value + difference, object.send(method, *args), "#{object}##{method}"
  end

  def assert_no_difference(object, method, *args, &block)
    assert_difference object, method, 0, *args, &block
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
compages-0.4.0 vendor/plugins/unobtrusive_javascript/test/lib/ptk/suite/difference.rb