[rspec-users] Missing model attribute in cucumber test

Aslak Hellesøy aslak.hellesoy at gmail.com
Wed Jan 14 16:05:06 EST 2009



> 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
>
> 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?

Where did you expect it to fail? This will fail:

my_user.should be_administrator

False return values never fails unless you use #should like above.

Aslak
>
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list