Ruby on Rails Thursday, May 29, 2014

On Thursday, May 29, 2014 5:54:26 AM UTC+1, Star Track wrote:
> I am writing a rails app with my colleague who wrote a lot of the tests.  He had to take a leave of absence due to a death in his family, and I am needing helps with changing the model so that the tests will pass in our spec file.
>
[snip]
> All of these tests are failing, and I'm not sure what to do.  I don't want to try something and accidentally break the model, as I am new to ruby on rails.  Thanks.
>

These specs are testing a method that doesn't exist yet ( it is pretty common to start by writing some specs and then writing the implementation). If you want them to pass you'll have to write a merge method that implements the behaviour described by the specs - hopefully the specs are descriptive enough to allow you to do this


Fred

> Fails:
>
> Failures:
>
>  
>
>         1) Worker merging two worker should return the winner
>          Failure/Error: @result = Worker.merge(@winner, @loser)
>          NoMethodError:
>            undefined method `merge' for #<Class:0x007fb612ee2ff8>
>          # ./spec/models/worker_spec.rb:15:in `block (3 levels) in <top (required)>'
>    
>       2) Person merging two people should not edit the winner's name
>          Failure/Error: @result = Worker.merge(@winner, @loser)
>          NoMethodError:
>            undefined method `merge' for #<Class:0x007fb612ee2ff8>
>          # ./spec/models/worker_spec.rb:15:in `block (3 levels) in <top (required)>'
>    
>       3) Person merging two people should merge the winner's email only if he has no email
>          Failure/Error: @result = Worker.merge(@winner, @loser)
>          NoMethodError:
>            undefined method `merge' for #<Class:0x007fb612ee2ff8>
>          # ./spec/models/worker_spec.rb:15:in `block (3 levels) in <top (required)>'
>    
>       4) Person merging two people should not edit the winner's company name
>          Failure/Error: @result = Worker.merge(@winner, @loser)
>          NoMethodError:
>            undefined method `merge' for #<Class:0x007fb612ee2ff8>
>          # ./spec/models/worker_spec.rb:15:in `block (3 levels) in <top (required)>'
>    
>       5) Person merging two people should delete the loser
>          Failure/Error: @result = Worker.merge(@winner, @loser)
>          NoMethodError:
>            undefined method `merge' for #<Class:0x007fb612ee2ff8>
>          # ./spec/models/worker_spec.rb:15:in `block (3 levels) in <top (required)>'
>    
>       6) Person merging two people should merge the notes together
>          Failure/Error: @result = Worker.merge(@winner, @loser)
>          NoMethodError:
>            undefined method `merge' for #<Class:0x007fb612ee2ff8>
>          # ./spec/models/worker_spec.rb:15:in `block (3 levels) in <top (required)>'

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7f9e9384-7df2-4fd5-873a-fdd661c196ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment