rake test fails with mocha > 2.1.0
robertcheramy opened this issue · 0 comments
robertcheramy commented
When using mocha > 2.1.0, the rake test fails:
Error: test_upload_should_raise_error_if_gets_not_ok(TestUpload):
NoMethodError: undefined method `sequences' for "file::stat":String
expectation.in_sequence(@mockery.sequences.last) if @mockery.sequences.any?
^^^^^^^^^^
/home/cheramr/net-scp/vendor/bundle/ruby/3.1.0/gems/mocha-2.3.0/lib/mocha/mock.rb:157:in `block in stubs'
/home/cheramr/net-scp/vendor/bundle/ruby/3.1.0/gems/mocha-2.3.0/lib/mocha/argument_iterator.rb:10:in `block in each'
/home/cheramr/net-scp/vendor/bundle/ruby/3.1.0/gems/mocha-2.3.0/lib/mocha/argument_iterator.rb:9:in `each'
/home/cheramr/net-scp/vendor/bundle/ruby/3.1.0/gems/mocha-2.3.0/lib/mocha/argument_iterator.rb:9:in `each'
/home/cheramr/net-scp/vendor/bundle/ruby/3.1.0/gems/mocha-2.3.0/lib/mocha/mock.rb:152:in `stubs'
/home/cheramr/net-scp/test/common.rb:86:in `stub!'
/home/cheramr/net-scp/test/common.rb:47:in `prepare_file'
/home/cheramr/net-scp/test/test_upload.rb:273:in `test_upload_should_raise_error_if_gets_not_ok'
270: end
271:
272: def test_upload_should_raise_error_if_gets_not_ok
=> 273: prepare_file("/path/to/local.txt", "")
274:
275: expect_scp_session "-t /path/to/remote.txt" do |channel|
276: channel.gets_data "\1"
freerange/mocha#645 gives the reason - Mocha::Mock.new is not supported, one have to use mock() :
This does not work as the classes FileEntry and Directory do not inherit Test::Unit::TestCase and are not monkey-patched with mocha (as far as I understand this right...)