The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
If you use Mocha and RSpec then read this

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jake Scruggs

Posts: 336
Nickname: aurorae314
Registered: Feb, 2008

Jake Scruggs is a developer at ThoughtWorks
If you use Mocha and RSpec then read this Posted: Nov 25, 2008 6:29 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jake Scruggs.
Original Post: If you use Mocha and RSpec then read this
Feed Title: Jake Scruggs
Feed URL: http://jakescruggs.blogspot.com/feeds/posts/default
Feed Description: Ruby, Rails, Metrics, Testing, and pursuit of clean code.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jake Scruggs
Latest Posts From Jake Scruggs

Advertisement
I like RSpec, but I'm not a huge fan of it's built in mocking framework. So, when I have the choice, I swap it out for Mocha. However, I really miss mock_model. If you haven't used it, mock_model is an RSpec method where you pass in an ActiveRecord object and it stubs out a whole bunch AR magic so you don't have to. This is crazy useful when testing controllers because when you controller has a line like this:
redirect_to(@model)

I don't want to dig through a ton of Rails code to figure out what I need to stub on this model, I just want it to work. But I just found out that Mislav Marohnić has written a plugin that implements mock_model for Mocha -- so now I can get the best of both worlds. You can find it here:
http://github.com/mislav/rspec-rails-mocha

Thanks Mislav.

Read: If you use Mocha and RSpec then read this

Topic: Discover You Blog Myers-Briggs Type Previous Topic   Next Topic Topic: Wall-E

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use