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'' 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090319/855b95ce/attachment.html>
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>
This is my env.rb # Sets up the Rails environment for Cucumber ENV["RAILS_ENV"] ||= "test" require File.expand_path(File.dirname(__FILE__) + ''/../../config/environment'') require ''cucumber/rails/world'' require ''cucumber/formatters/unicode'' # Comment out this line if you don''t want Cucumber Unicode support Cucumber::Rails.use_transactional_fixtures require ''webrat'' Webrat.configure do |config| config.mode = :rails config.application_address= "myapp.local" end require ''cucumber/rails/rspec'' require ''webrat/core/matchers'' The only thing different is: config.application_address= "myapp.local" I tried to comment out this line and it didn''t help anyway. I did script/generate cucumber and it didn''t help. :( Yi 2009/3/19 aslak hellesoy <aslak.hellesoy at gmail.com>> > > 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 (::) > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- http://yiwenandsoftware.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090319/2c5212c2/attachment.html>
Right, you need to add require ''spec/expectations'' because Cucumber doesn''t know about RSpec''s matchers by default. Pat 2009/3/19 Yi <hayafirst at gmail.com>:> This is my env.rb > > # Sets up the Rails environment for Cucumber > ENV["RAILS_ENV"] ||= "test" > require File.expand_path(File.dirname(__FILE__) + > ''/../../config/environment'') > require ''cucumber/rails/world'' > require ''cucumber/formatters/unicode'' # Comment out this line if you don''t > want Cucumber Unicode support > Cucumber::Rails.use_transactional_fixtures > > require ''webrat'' > > Webrat.configure do |config| > ? config.mode = :rails > ? config.application_address= "myapp.local" > end > > require ''cucumber/rails/rspec'' > require ''webrat/core/matchers'' > > > The only thing different is: > ? config.application_address= "myapp.local" > > I tried to comment out this line and it didn''t help anyway. > > I did script/generate cucumber and it didn''t help. :( > > Yi > > 2009/3/19 aslak hellesoy <aslak.hellesoy at gmail.com> >> >> >> 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 (::) >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > http://yiwenandsoftware.wordpress.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
I thought be_something is actually handled by rspec class Be. be_blank essentially asks the object blank? predicate. Not that there is a "be_blank" method declared anywhere. Anyway, require ''spec/expectations'' doesn''t solve the problem. I will look into this. Thanks Yi On Thu, Mar 19, 2009 at 10:59 AM, Pat Maddox <pat.maddox at gmail.com> wrote:> Right, you need to add > require ''spec/expectations'' > > because Cucumber doesn''t know about RSpec''s matchers by default. > > Pat > > 2009/3/19 Yi <hayafirst at gmail.com>: > > This is my env.rb > > > > # Sets up the Rails environment for Cucumber > > ENV["RAILS_ENV"] ||= "test" > > require File.expand_path(File.dirname(__FILE__) + > > ''/../../config/environment'') > > require ''cucumber/rails/world'' > > require ''cucumber/formatters/unicode'' # Comment out this line if you > don''t > > want Cucumber Unicode support > > Cucumber::Rails.use_transactional_fixtures > > > > require ''webrat'' > > > > Webrat.configure do |config| > > config.mode = :rails > > config.application_address= "myapp.local" > > end > > > > require ''cucumber/rails/rspec'' > > require ''webrat/core/matchers'' > > > > > > The only thing different is: > > config.application_address= "myapp.local" > > > > I tried to comment out this line and it didn''t help anyway. > > > > I did script/generate cucumber and it didn''t help. :( > > > > Yi > > > > 2009/3/19 aslak hellesoy <aslak.hellesoy at gmail.com> > >> > >> > >> 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 (::) > >> > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > > -- > > http://yiwenandsoftware.wordpress.com > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- http://yiwenandsoftware.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090319/a36f9ca0/attachment.html>
Just did a little bit exploration. Found out http://github.com/carlosbrando/remarkable/tree/master plugin I use actually cause the problem. This plugin also broke spec:server:start rake task as well. :-( On Thu, Mar 19, 2009 at 5:03 PM, Yi <hayafirst at gmail.com> wrote:> I thought be_something is actually handled by rspec class Be. be_blank > essentially asks the object blank? predicate. Not that there is a "be_blank" > method declared anywhere. > > Anyway, require ''spec/expectations'' doesn''t solve the problem. I will look > into this. Thanks > > Yi > > > On Thu, Mar 19, 2009 at 10:59 AM, Pat Maddox <pat.maddox at gmail.com> wrote: > >> Right, you need to add >> require ''spec/expectations'' >> >> because Cucumber doesn''t know about RSpec''s matchers by default. >> >> Pat >> >> 2009/3/19 Yi <hayafirst at gmail.com>: >> > This is my env.rb >> > >> > # Sets up the Rails environment for Cucumber >> > ENV["RAILS_ENV"] ||= "test" >> > require File.expand_path(File.dirname(__FILE__) + >> > ''/../../config/environment'') >> > require ''cucumber/rails/world'' >> > require ''cucumber/formatters/unicode'' # Comment out this line if you >> don''t >> > want Cucumber Unicode support >> > Cucumber::Rails.use_transactional_fixtures >> > >> > require ''webrat'' >> > >> > Webrat.configure do |config| >> > config.mode = :rails >> > config.application_address= "myapp.local" >> > end >> > >> > require ''cucumber/rails/rspec'' >> > require ''webrat/core/matchers'' >> > >> > >> > The only thing different is: >> > config.application_address= "myapp.local" >> > >> > I tried to comment out this line and it didn''t help anyway. >> > >> > I did script/generate cucumber and it didn''t help. :( >> > >> > Yi >> > >> > 2009/3/19 aslak hellesoy <aslak.hellesoy at gmail.com> >> >> >> >> >> >> 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 (::) >> >> >> >> _______________________________________________ >> >> rspec-users mailing list >> >> rspec-users at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/rspec-users >> > >> > >> > >> > -- >> > http://yiwenandsoftware.wordpress.com >> > >> > _______________________________________________ >> > rspec-users mailing list >> > rspec-users at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/rspec-users >> > >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > > > -- > http://yiwenandsoftware.wordpress.com >-- http://yiwenandsoftware.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090325/001194d4/attachment.html>
Just for reference, whoever have problem with rspec, remarkable and cucumber, try this installation settings: # config/environments/test.rb config.gem "rspec", :lib => false config.gem "rspec-rails", :lib => false config.gem "remarkable_rails", :lib => false # spec/spec_helper.rb require "spec/rails" require "remarkable_rails" If you still have problems, be sure to open a ticket on Remarkable bug tracking: http://carlosbrando.lighthouseapp.com/projects/19775-remarkable/tickets?q=all Cheers, -- Jos? Valim http://josevalim.blogspot.com/ http://github.com/josevalim/ Yi Wen wrote:> > Just did a little bit exploration. Found out > http://github.com/carlosbrando/remarkable/tree/master plugin I use > actually > cause the problem. This plugin also broke spec:server:start rake task as > well. :-( > > On Thu, Mar 19, 2009 at 5:03 PM, Yi <hayafirst at gmail.com> wrote: > >> I thought be_something is actually handled by rspec class Be. be_blank >> essentially asks the object blank? predicate. Not that there is a >> "be_blank" >> method declared anywhere. >> >> Anyway, require ''spec/expectations'' doesn''t solve the problem. I will >> look >> into this. Thanks >> >> Yi >> >> >> On Thu, Mar 19, 2009 at 10:59 AM, Pat Maddox <pat.maddox at gmail.com> >> wrote: >> >>> Right, you need to add >>> require ''spec/expectations'' >>> >>> because Cucumber doesn''t know about RSpec''s matchers by default. >>> >>> Pat >>> >>> 2009/3/19 Yi <hayafirst at gmail.com>: >>> > This is my env.rb >>> > >>> > # Sets up the Rails environment for Cucumber >>> > ENV["RAILS_ENV"] ||= "test" >>> > require File.expand_path(File.dirname(__FILE__) + >>> > ''/../../config/environment'') >>> > require ''cucumber/rails/world'' >>> > require ''cucumber/formatters/unicode'' # Comment out this line if you >>> don''t >>> > want Cucumber Unicode support >>> > Cucumber::Rails.use_transactional_fixtures >>> > >>> > require ''webrat'' >>> > >>> > Webrat.configure do |config| >>> > config.mode = :rails >>> > config.application_address= "myapp.local" >>> > end >>> > >>> > require ''cucumber/rails/rspec'' >>> > require ''webrat/core/matchers'' >>> > >>> > >>> > The only thing different is: >>> > config.application_address= "myapp.local" >>> > >>> > I tried to comment out this line and it didn''t help anyway. >>> > >>> > I did script/generate cucumber and it didn''t help. :( >>> > >>> > Yi >>> > >>> > 2009/3/19 aslak hellesoy <aslak.hellesoy at gmail.com> >>> >> >>> >> >>> >> 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 (::) >>> >> >>> >> _______________________________________________ >>> >> rspec-users mailing list >>> >> rspec-users at rubyforge.org >>> >> http://rubyforge.org/mailman/listinfo/rspec-users >>> > >>> > >>> > >>> > -- >>> > http://yiwenandsoftware.wordpress.com >>> > >>> > _______________________________________________ >>> > rspec-users mailing list >>> > rspec-users at rubyforge.org >>> > http://rubyforge.org/mailman/listinfo/rspec-users >>> > >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> >> >> >> -- >> http://yiwenandsoftware.wordpress.com >> > > > > -- > http://yiwenandsoftware.wordpress.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- View this message in context: http://www.nabble.com/-Cucumber-0.2--Failure-to-use-should-tp22601600p23316997.html Sent from the rspec-users mailing list archive at Nabble.com.