[rspec-users] Missing model attribute in cucumber test

Fernando García Samblas fernando.garcia at the-cocktail.com
Wed Jan 14 15:54:08 EST 2009


James Byrne escribió:
> James Byrne wrote:
>
> I have gotten past this somehow.  The only thing that I think may have 
> influenced this is manually preparing the test database.  However, now I 
> have a different problem.
>
> Here is the same step definition:
>
> When /user named "(.*)" is an administrator/ do |name|
>   my_user = User.find_by_username!(name)
>   puts my_user.administrator.to_s
>   my_user.administrator
> end
>   

I think the last statement of the step definition "should be":

  my_user.administrator.should be_true

for an rspec based implementation, or

  fail unless my_user.administrator

 for a pure cucumber one.

> This produces this output in a cucumber run:
>
> false
>     And the user named "newuser" is an administrator     # 
> features/app/models/users/step_definitions/user_steps.rb:24
>
> Notice the value reported from the puts statement.  Yet, this feature 
> step passes.   What am I doing wrong?
>   

-- 
Fernando García Samblas
fernando.garcia at the-cocktail.com
http://nando.lacoctelera.com

The Cocktail
C/ Salamanca 17
28020 Madrid
+34 91 567 06 05



More information about the rspec-users mailing list