[rspec-users] Testing update, flash[:error]
robert.dober at gmail.com
Mon Nov 22 16:55:03 EST 2010
On Mon, Nov 22, 2010 at 4:04 PM, Paul Nelligan <nellboy at gmail.com> wrote:
> Hi Andrew
> I suspect that flash[:error] is not a valid identifier, and therefore is
> returning a nil value.
> Hope this is of use to you.
> On Mon, Nov 22, 2010 at 2:00 PM, Andrew Davis <lists at ruby-forum.com> wrote:
>> Hello everyone,
>> I'm trying to write a failure test for updating a model, but the
>> flash[:error] seems to be causing a problem.
>> All code can be found here:
>> I've also tried using regular expressions, instead of:
>> flash[:error].should == "Name can't be blank"
>> I've tried:
>> flash[:error].should =~ /Name can't be blank/i
As Paul pointed out correctly flash[:error] == nil, thus your spec
works quite correctly. All you have to do now is to set flash[:error]
appropriately, in your case I guess that this should be done by means
of ActiveRecord/ActiveModel validations.
Are you sure that you have the necessary validation in your Task model?
The 1,000,000th fibonacci number contains '42' 2039 times; that is
almost 30 occurrences more than expected (208988 digits).
N.B. The 42nd fibonacci number does not contain '1000000' that is
almost the expected 3.0e-06 times.
More information about the rspec-users