On Fri, Oct 10, 2008 at 3:05 AM, Matt Wynne <matt at mattwynne.net> wrote:
> Do we need to make it a bit clearer on the rspec.info site that cucumber is
> the way forward? The trail of blog posts etc with the up-to-date info is
> probably fairly bewildering to a newbie.
I updated the website (just a quick few tweaks).
FYI - the website is in the rspec-dev project on github:
http://github.com/dchelimsky/rspec-dev
Please feel absolutely free at any time to contribute patches to this
if you learn info that you think should be up there.
Thanks,
David
>> On 9 Oct 2008, at 19:38, Mark Thomson wrote:
>>> Thanks guys. I took your advice and moved to cucumber. It did turn out to
>> be useful in that the more verbose error reporting led me to dive more
>> deeply into the webrat source, eventually leading me to my problem - which
>> actually was essentially the same noob error I made a few days when I failed
>> to realize my development code had a data migration that hadn't populated
>> the test db.
>>>> In this case the updated form mentioned in my earlier post had selection
>> inputs whose options are meant to be stored in the db. Since they weren't
>> actually there, there were no select options in the form.
>>>> What was puzzling initially was that an error related to selection inputs
>> was showing up in the fills_in call. But it turns out that webrat looks for
>> the named text field by searching over all the input tags in the form. In
>> the process of parsing the selection inputs it was throwing up when it
>> didn't find the option tags it was expecting.
>>>> Mark.
>>>>>>>> David Chelimsky wrote:
>>>>>> On Thu, Oct 9, 2008 at 1:57 AM, Matt Wynne <matt at mattwynne.net> wrote:
>>>>>>> On 9 Oct 2008, at 02:55, Mark Thomson wrote:
>>>>>>>>>>>>> I have an RSpec story with an overall structure that looks something
>>>>> like
>>>>> this -
>>>>>>>>>> ----
>>>>> Given the user is on the start page
>>>>> When the user clicks the 'new' button
>>>>> Then the 'new record' page should be displayed
>>>>>>>>>> When the user fills in the form
>>>>> And the user submits the form
>>>>> Then the updated form should be displayed
>>>>>>>>>> When the user fills in the updated form
>>>>> And the user submits the form
>>>>> Then a conformation message should be displayed
>>>>> ----
>>>>>>>>>> In the last When step, I have a fills_in call that is failing with the
>>>>> following:
>>>>>>>>>> ----
>>>>> NoMethodError: You have a nil object when you didn't expect it! You
>>>>> might
>>>>> have expected an instance of ActiveRecord::Base. The error occurred
>>>>> while
>>>>> evaluating nil.attributes.
>>>>> ----
>>>>>>>>>> I think the ActiveRecord thing is a red herring. Poking through the
>>>>> Webrat
>>>>> source code, it seems like the problem is more likely a failure to find
>>>>> any
>>>>> input fields. But I'm not sure why. Is there anything inappropriate
>>>>> with the
>>>>> way I've organized the story, stringing together multiple When-Then
>>>>> segments? One thing that seems curious is that I have a completely
>>>>> identical
>>>>> fills_in call in the When step that precedes the one that is failing
>>>>> and yet
>>>>> that one runs without any problem.
>>>>>>>>> I think this sort of error tends to happen while a view is being
>>>> rendered,
>>>> so my guess is it's something to do with your data setup.
>>>>>>>> Sorry to bang on about this, but cucumber has much better support for
>>>> error
>>>> messages - you might want to consider making the switch before you waste
>>>> too
>>>> much time on this issue.
>>>>>>> Matt is correct, you should definitely consider moving to cucumber,
>>> though I don't know that cucumber will necessary help you shed any
>>> more light on this particular issue.
>>>>>> Mark, with the little bit of information you've provided, my best
>>> guess would be that the :new action is providing some instance
>>> variable that is not being provided by the :create action in the case
>>> where the data from "When the user fills in the form" is incorrect or
>>> insufficient to save the model.
>>>>>> If that's not correct, please post the code for the steps and the
>>> relevant controller actions.
>>>>>> Cheers,
>>> David
>>> _______________________________________________
>>> rspec-users mailing list
>>>rspec-users at rubyforge.org>>>http://rubyforge.org/mailman/listinfo/rspec-users>>>>>>>>>>> _______________________________________________
>> rspec-users mailing list
>>rspec-users at rubyforge.org>>http://rubyforge.org/mailman/listinfo/rspec-users>> _______________________________________________
> rspec-users mailing list
>rspec-users at rubyforge.org>http://rubyforge.org/mailman/listinfo/rspec-users>