[rspec-users] Specifying a few valid values
loop at superinfinite.com
Mon Jul 21 11:36:23 EDT 2008
On 18-jul-2008, at 1:22, David Chelimsky wrote:
> On Thu, Jul 17, 2008 at 11:04 AM, Jonathan Leighton
> <j at jonathanleighton.com> wrote:
>> On Thu, 2008-07-17 at 09:40 -0500, David Chelimsky wrote:
>>> On Thu, Jul 17, 2008 at 9:37 AM, Zach Dennis
>>> <zach.dennis at gmail.com> wrote:
>>>> When "I login with invalid credentials"
>>>> Then "I see that I have not been logged in"
>>> Or ....
>>> When I login with invalid credentials
>>> Then I should see the login form
>>> And I should see a message saying "Something went wrong."
>> What would be the implementation of "Then I should see the login
>> We are already testing for an error message :)
> As with all things, context is everything.
Definately. For what it's worth, my approach:
I use the "should see the form | page" construct a lot when
implementing new functionality. I expect a form with just
response.should have_tag('form[action=?]', blogposts_path), and spec
the form fields in my view specs. This ensures that my integration
tests won't necessarily break when I change a form field, but it does
get picked up by the view specs. After I'm done prototyping, I write
higher level stories dealing with the flow of the functionality.
> *If* I were going to have such a step, I'd do it based on things in
> the form:
> Then "should see the login form" do
> response.should have_tag('input#login')
> response.should have_tag('input#password')
> That's more granular than I generally like, but that's what probably
> what I'd do in this scenario.
More information about the rspec-users