[rspec-users] be_true and be_false are suddenly undefined

Doug dgoldie15 at gmail.com
Fri Dec 25 20:22:10 EST 2009


I figured it out last night.
...sorry I didn't post then

I created a blank rails project and used:
$ script/generate --webrat --rspec

then compared the features/support/env.rb; mine was missing:
require 'cucumber/rails/rspec'

after adding that statement, the be_true and be_falses worked fine
then I removed all the other requires as you suggested above

NOTE: I believe that's the way the file was generated. I don't
remember editing the env.rb file -- per the instructions, but I don't
remember.
using the options: --webrat --rspec --testunit
.....Now I only included the option for testunit out of curiousity;
was that a mistake?

I'll try to reproduce it.

thanks



On Dec 25, 2:45 am, aslak hellesoy <aslak.helle... at gmail.com> wrote:
> > I agree....
>
> > I did notice that my feature/support/my_env.rb (custom) had:
> > require 'spec'
> > require 'spec/rails'
>
> > so I changed first line
> > require 'spec/autorun'
>
> You shouldn't do that. You don't want the RSpec runner to run when you're
> using Cucumber.
> In fact, you shouldn't do any RSpec requires in my_env.rb at all - all that
> setup is done in env.rb.
>
> > in keeping with
> >http://wiki.github.com/dchelimsky/rspec/configgem-for-rails
>
> > seems to me that really should do it, but it doesn't work.????
>
> I'm assuming you have followed the upgrade instructions that Matt mentioned.
> However your setup still seems broken so I'm wondering if you succeeded.
>
> Could you pastie or gist your env.rb and my_env.rb files so we can take a
> peek?
>
> I've tried requiring spec_helper, etc. putting the requires closer to
>
> > my code.,etc.
>
> You should never load your spec_helper.rb from Cucumber.
>
>
>
>
>
> nothing works!!!!
>
> > btw: be_true and be_false work in my existing spec test; it's just in
> > cucumber steps.
>
> > ????
>
> > On Dec 24, 1:14 am, Matt Wynne <m... at mattwynne.net> wrote:
> > > On 24 Dec 2009, at 06:09, Doug wrote:
>
> > > > after upgrading cucumber to 5.1 be_true and be_false are undefined
> > > > switching to == true  or == false works.
>
> > > > ??? thanks.
>
> > > The rails integration changed quite a bit for that release. See [1]
> > > plus a few recent threads on this list.
>
> > > It sounds like your specific problem is you don't have rspec's
> > > matchers required anymore.
>
> > > [1]http://wiki.github.com/aslakhellesoy/cucumber/upgrading
>
> > > >    Then there is an invalid item with 1 "upc"
> > > > error                     # features/step_definitions/
> > > > extract_steps.rb:
> > > > 56
> > > >      undefined method `be_true' for
> > > > #<ActionController::Integration::Session:0x104bc7820> (NoMethodError)
> > > >      ./features/step_definitions/extract_steps.rb:45:in `/^retrieve
> > > > file$/'
>
> > > > Then /^retrieve file$/ do
> > > >  basename = File.basename(@filename)
> > > >  ExtractReport.exists?(:file_name => basename).should ==
> > > > true                   **** this is line 45
> > > >  @file = ExtractReport.find_by_file_name(basename)
> > > >  count = @file.record_count.to_i - 2 # count includes header and
> > > > trailer
> > > >  @file.should have(count).items
> > > > end
> > > > _______________________________________________
> > > > rspec-users mailing list
> > > > rspec-us... at rubyforge.org
> > > >http://rubyforge.org/mailman/listinfo/rspec-users
>
> > > cheers,
> > > Matt
>
> > >http://mattwynne.net
> > > +447974 430184
>
> > > _______________________________________________
> > > rspec-users mailing list
> > > rspec-us... at rubyforge.orghttp://
> > rubyforge.org/mailman/listinfo/rspec-users
> > _______________________________________________
> > rspec-users mailing list
> > rspec-us... at rubyforge.org
> >http://rubyforge.org/mailman/listinfo/rspec-users
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list