ruby-mocha
Test method that was called from other method
I have module Database with method generate_from_database that spins for loops and calls method get_length. How can I te开发者_高级运维st if get_length was called n times, by using rspec or mocha?[详细]
2023-01-27 23:37 分类:问答Why am I getting a NoMethodError when I use Mocha 0.9.8 with Test::Unit 2.1.1
Has anyone seen this? Here\'s the error: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -rrubygems -e \"require \'redgreen\'\"-I.:lib:test -rubygems -e \"[\'test/unit\', \'test/t[详细]
2023-01-14 12:51 分类:问答Getting Rails 3 Generators with Rspec 2 and Mocha
I\'ve followed all of the steps that I\'ve been able to find online for configuring Rails 3 with Rspec 2 and Mocha. In my Gemfile:[详细]
2023-01-09 18:24 分类:问答Mocha Mock Carries To Another Test
I have been following the 15 TDD steps to create a Rails application guide - but have run into an issue I cannot seem to resolve.For the functional test of the WordsController, I have the following co[详细]
2023-01-05 05:10 分类:问答Is there a way to undo Mocha stubbing of any_instance in Test::Unit
Much like this question, I too am using Ryan Bates\'s nifty_scaffold. It has the desirable aspect of using Mocha\'s any_instance method 开发者_C百科to force an \"invalid\" state in model objects burie[详细]
2022-12-31 03:55 分类:问答Testing methods called on yielded object
I have the following controller test case: def test_showplain Cleaner.expect(:parse).with(@somecontent)[详细]
2022-12-30 02:29 分类:问答How to return a dynamic value from a Mocha mock in Ruby
The gist of my problem is as follows:- I\'m writing a Mocha mock in Ruby for the method represented as \"post_to_embassy\" below. It is not really our concern, for the purpose of describing the probl[详细]
2022-12-28 12:22 分类:问答Is there a way to undo Mocha stubbing of any_instance?
Within my controller specs I am stubbing开发者_运维知识库 out valid? for some routing tests, (based on Ryan Bates nifty_scaffold) as follows :-[详细]
2022-12-28 02:23 分类:问答Mocking Sort With Mocha
How can I mock an array\'s sort expect a lambda expression? This is a trivial example of my problem: # initializing the data[详细]
2022-12-25 16:46 分类:问答Difference between RR mock.instance_of and Mocha any_instance
I have the following rspec code: require \'spec_helper\' require \'mocha\' require \'rr\' describe ProjectsController, \"creating a new project\" do[详细]
2022-12-15 09:08 分类:问答