ruby-mocha
Mocking/stubbing a method that's included from "instance.extend(DecoratorModule)"
I use a decorator module that get\'s included in a model instance (through the \"extends\" method). So for example :[详细]
2023-04-11 14:39 分类:问答NoMethodError: undefined method `mock' with Mocha and Rails 3
I\'m trying to use mocha in my Rails 3 project but keep getting the following exception: NoMethodError: undefined method `mock\' for #<MochaTest:0x00000101f434e8>[详细]
2023-04-10 06:06 分类:问答Unable to create a mock object with mocha
I keep getting this error... mockresponse.rb:4:in `createResponseObject\': undefined method `mock\' for main:Object (NoMethodError)[详细]
2023-04-03 10:25 分类:问答How to mock Rails::configuration
I\'m attempting to test a class whic开发者_开发问答h makes use of the rails configuration file.I\'d like to mock Rails::configuration.[详细]
2023-04-01 05:51 分类:问答Global mock with mocha
I have many tests for my class. When I added check for file existence, in my 开发者_JAVA百科class.[详细]
2023-03-30 16:50 分类:问答How do I stub away send_file using mocha
The most direct attempt is to do @controller.stubs(:send_file) But that results in an output error like[详细]
2023-03-29 05:18 分类:问答TDD with mocha and mongodb
I\'m trying to add mongodb via Mongo Ruby Driver to my sinatra app, and I\'ve decided to so it the right way. When I started to think about TDD I coudn\'t find any examples or guidance about how to do[详细]
2023-02-25 05:34 分类:问答getting the object passed as an argument to a stubbed method with Mocha
Foo.expects(:bar) Foo.bar(:abc => 123, :xyz => 987) # assert Foo.bar was cal开发者_StackOverflowled with a hash that has a key of :abc == 123[详细]
2023-02-13 01:56 分类:问答Is there a way to set the value of $? in a mock in Ruby?
I am testing some scripts that interface wit开发者_如何转开发h system commands. Their logic depends on the return code of the system commands, i.e. the value of $?. So, as a simplified example, the sc[详细]
2023-02-02 21:26 分类:问答Is there a Mocha equivalent of Rspec’s “mock().as_null_object”?
Is there a Mocha equivalent of Rspec’s “mock().开发者_开发技巧as_null_object”?Yes. Use “stub_everything()”[详细]
2023-01-31 12:05 分类:问答