[rspec-users] [Cucumber 0.2] Failure to use should

aslak hellesoy aslak.hellesoy at gmail.com
Thu Mar 19 11:13:19 EDT 2009


2009/3/19 Yi <hayafirst at gmail.com>

> I have a step definition like this:
>
> Then "the account should be created" do
>   account = Account.find_by_name("my shiny new account")
>   p account.class
>   account.should_not be_blank
> end
>
> When running this step, I got the error message:
>
> Account(id: integer, name: string, state: string, next_renewal_at: date,
> created_at: datetime, updated_at: datetime, full_domain: string, deleted_at:
> datetime, subscription_discount_id: integer, subscription_plan_id: integer)
>
>     And the account should be created              #
> features/step_definitions/create_account_steps.rb:31
>       undefined method `be_blank' for
> #<ActionController::Integration::Session:0x349994c> (NoMethodError)
>       features/create_account.feature:10:in `And the account should be
> created'
>

The #be_blank method is defined by a module under 'rspec/matchers'. This
module is automatically included in ActionController::Integration::Session
if you have the following in your env.rb:

require 'spec/expectations'

Do you? If you just upgraded to Cucumber 0.2 you should probably rebootstrap
Cucumber with:

script/generate cucumber

Aslak


> I print out the account class, which is a AR::B. Why cucumber tells me it
> is a ActionController::Integration::Session?
>
> I use cucumber 0.2 and rspec 1.2 with Rails 2.3.2
>
> Thanks
>
> Yi
> --
> http://yiwenandsoftware.wordpress.com
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
Aslak (::)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090319/fb2d378f/attachment.html>


More information about the rspec-users mailing list