My question is, why bother?  Unless I'm missing something, testing for
the existence of an error that your code will never provide sounds
backwards. Instead test that you DON'T get an error when the required
value isn't explicitly supplied, to confirm that the default works.
(Although, really, the "pure" time to do that would've been before
writing the migration, to get the red-to-green verification. That may
be excessively pedantic though.)

On 4/18/09, Pat Maddox <pat.mad...@gmail.com> wrote:
> On Sat, Apr 18, 2009 at 3:09 AM, svoop <sv...@delirium.ch> wrote:
>> Pat Maddox <pat.mad...@...> writes:
>>> Okay I must be dense because I'm not sure what you mean by it gets in
>>> the way of refactoring.
>>
>> Actually, scratch that, because...
>>
>>> And you're right about how it behaves...that's exactly how default
>>> attrs work.  If you want to test that your model doesn't allow invalid
>>> data, you have to explicitly give it invalid data.
>>
>> Using .with instead of .except does the trick just fine and does just
>> that, set
>> the model explicitly to invalid data.
>
> gah, I totally get it now!  Wasn't noticing that in one case you were
> passing in a full attributes hash (valid_attributes) and in the second
> you were only setting one value.  Makes sense to me now.  Glad you
> figured it out :)
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


-- 
Have Fun,
   Steve Eley (sfe...@gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine
   http://www.escapepod.org
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to