mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00

git-svn-id: https://svn.thoughtbot.com/plugins/tb_test_helpers/trunk@48 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
25 lines
491 B
Ruby
25 lines
491 B
Ruby
require File.join(File.dirname(__FILE__), 'test_helper')
|
|
|
|
class Val
|
|
@@val = 0
|
|
def self.val; @@val; end
|
|
def self.inc(i=1); @@val += i; end
|
|
end
|
|
|
|
class ContextTest < Test::Unit::TestCase # :nodoc:
|
|
|
|
context "assert_difference" do
|
|
should "pass when incrementing by one" do
|
|
assert_difference(Val, :val, 1) do
|
|
Val.inc
|
|
end
|
|
end
|
|
|
|
should "pass when incrementing by two" do
|
|
assert_difference(Val, :val, 2) do
|
|
Val.inc(2)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|