test/unit/auto_verify_test.rb in mocha-0.5.5 vs test/unit/auto_verify_test.rb in mocha-0.5.6
- old
+ new
@@ -7,11 +7,10 @@
attr_reader :test_case
def setup
@test_case = Object.new
class << test_case
- def self.add_teardown_method(symbol); end
include Mocha::AutoVerify
end
end
def test_should_build_mock
@@ -36,11 +35,11 @@
assert_equal 'result_2', stub.method_2
end
def test_should_build_stub_that_stubs_all_methods
stub = test_case.stub_everything
- assert stub.stub_everything
+ assert stub.everything_stubbed
end
def test_should_add_expectations_to_stub_that_stubs_all_methods
stub = test_case.stub_everything(:method_1 => 'result_1', :method_2 => 'result_2')
assert_equal 'result_1', stub.method_1
@@ -76,11 +75,15 @@
def test_should_verify_each_mock
mocks = Array.new(3) do
mock = Object.new
mock.define_instance_accessor(:verify_called)
- mock.define_instance_method(:verify) { self.verify_called = true }
+ class << mock
+ def verify(&block)
+ self.verify_called = true
+ end
+ end
mock
end
test_case.replace_instance_method(:mocks) { mocks }
test_case.verify_mocks
assert mocks.all? { |mock| mock.verify_called }
@@ -115,8 +118,12 @@
end
def test_should_create_named_stub_that_stubs_all_methods
stub = test_case.stub_everything('named_stub')
assert_equal '#<Mock:named_stub>', stub.mocha_inspect
+ end
+
+ def test_should_build_sequence
+ assert_not_nil test_case.sequence('name')
end
end
\ No newline at end of file