[rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)

David Chelimsky dchelimsky at gmail.com
Sat Feb 7 13:16:58 EST 2009


On Sat, Feb 7, 2009 at 9:59 AM, Nick Hoffman <nick at deadorange.com> wrote:
> On 06/02/2009, at 10:00 PM, s.ross wrote:
>>
>> I did stop writing new controller specs, but we were discussing the
>> use-case for controller specs in the new Cukified world. Supposing you write
>> scenarios that pretty much describe your app, what could possibly go wrong
>> that a controller spec would catch but a cucumber story pass? My environment
>> is not using Selenium or Watir, so any action that is Ajaxey potentially
>> needs a controller spec example. I'm less clear that routing needs to be in
>> the specs, but shoulda makes that stupid-simple, so it's a way to make sure
>> I don't break something embarrassing when I'm goofing around in routes.
>>
>> I'm starting to think that Cucumber can do 90+% of the heavy lifting, but
>> for describing what kind of response a controller will ship back (json or
>> html), based on the request, user-agent specific stuff. All that would
>> probably have to happen in controller specs.
>>
>> In response to Jay's post, I test what I'm afraid might fail. I test it to
>> clarify my thinking as I build it. So if it's important that a controller
>> return json in response to an XmlHttp request, then that's part of the spec.
>>
>> Does this sound reasonable?
>
> When writing Cucumber stories and features for controllers, should you cover
> every edge case? For example, should you write stories that feed bad or
> missing data to your controllers, or should that be left to RSpec?

Depends on the team and who can read what and who cares about what.

In most cases, Cucumber is a significantly better
developer/stakeholder collaboration tool than RSpec is. If your
stakeholders trust you to cover the edge cases, then they don't need
to be in cucumber, but they certainly can be.

IASTDH,
David

> -Nick
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list