ruby on rails - Stubbing A Model Attribute -


I am writing RSPEC test for my car class, and there is a question about joking about the parts array in cars I want to stumble, how can I do this?

I have the following code:

  There are cars in the class: parts def heavy_count parts injection (0) {| Sum, v | V.weight & gt; 10? (= "#heavy_count") reference (: car) {mock_model (car, etc.) with the test  

  : Brand = & gt; "Toyota")} Let's (: Vote1) {mock_model (part ,: weight => 11)} ((vote: 2) {mock_model (part, weight => 11) } "2 If more than 10 parts 2 is heavy" What # do I stub parts here? Suppose you are using RSPC for fun and not the second framework:  

< P> part.should_receive (: find) .and_return ([vote_1, vote2])


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -