Ed Howland
2008-Feb-19 18:32 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
Hi, I am trying to get Webrat integrated with RSpec. I''ve followed the steps in the various blog posts about this, but have one sniggling little issue. It might be a Webrat issue, but I am hoping the RSpec folks might have already solved it. I have the stories run from a Rake task (am hoping for one of these in the main rspec rake task soon,) ut to run webrat stuff in the steps, you need to: rake spec:stories RAILS_ENV=test. The reason is due to the boot order of rake and plugins (of which webrat and rspec are ones), webrat/init.rb doesn''t attach itself to ActionController::Integration::Session unless it is on the test environment. Only setting the RAILS_ENV ahead of the boot sequence fixes this. But I am wondering if there is another alternative. Also, has anyone gotten it to run with autotest? Thanks in advance. Ed -- Ed Howland http://greenprogrammer.blogspot.com "The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, confidential and/or legally privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers."
James Deville
2008-Feb-19 18:45 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
I set RAILS_ENV in my stories/helper.rb file. That might be a good solution. On Feb 19, 2008, at 10:32 AM, Ed Howland wrote:> Hi, > > I am trying to get Webrat integrated with RSpec. I''ve followed the > steps in the various blog posts about this, but have one sniggling > little issue. It might be a Webrat issue, but I am hoping the RSpec > folks might have already solved it. > > I have the stories run from a Rake task (am hoping for one of these > in the main rspec rake task soon,) ut to run webrat stuff in the > steps, you need to: > > rake spec:stories RAILS_ENV=test. > > The reason is due to the boot order of rake and plugins (of which > webrat and rspec are ones), webrat/init.rb doesn''t attach itself to > ActionController::Integration::Session unless it is on the test > environment. Only setting the RAILS_ENV ahead of the boot sequence > fixes this. But I am wondering if there is another alternative. > > Also, has anyone gotten it to run with autotest? > > Thanks in advance. > > Ed > > > > > -- > Ed Howland > http://greenprogrammer.blogspot.com > "The information transmitted is intended only for the person or entity > to which it is addressed and may contain proprietary, confidential > and/or legally privileged material. Any review, retransmission, > dissemination or other use of, or taking of any action in reliance > upon, this information by persons or entities other than the intended > recipient is prohibited. If you received this in error, please contact > the sender and delete the material from all computers." > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-usersJames Deville http://devillecompanies.org james.deville at gmail.com rspec r3172 rspec_on_rails r3172 rails r8331
Jarkko Laine
2008-Feb-20 07:02 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
On 19.2.2008, at 20.45, James Deville wrote:> I set RAILS_ENV in my stories/helper.rb file. That might be a good > solution. > > > On Feb 19, 2008, at 10:32 AM, Ed Howland wrote: > >> Hi, >> >> I am trying to get Webrat integrated with RSpec. I''ve followed the >> steps in the various blog posts about this, but have one sniggling >> little issue. It might be a Webrat issue, but I am hoping the RSpec >> folks might have already solved it. >> >> I have the stories run from a Rake task (am hoping for one of these >> in the main rspec rake task soon,) ut to run webrat stuff in the >> steps, you need to: >> >> rake spec:stories RAILS_ENV=test. >> >> The reason is due to the boot order of rake and plugins (of which >> webrat and rspec are ones), webrat/init.rb doesn''t attach itself to >> ActionController::Integration::Session unless it is on the test >> environment. Only setting the RAILS_ENV ahead of the boot sequence >> fixes this. But I am wondering if there is another alternative. >> >> Also, has anyone gotten it to run with autotest?Using Webrat for 100% of my stories (and running autotest) and loving it. I also have the env set in stories/helper.rb, but I''m not sure whether it was there from the beginning (I just copied it from some of the early posts about stories). //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://rubyforge.org/pipermail/rspec-users/attachments/20080220/1de36c08/attachment.bin
David Chelimsky
2008-Feb-20 12:32 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
On Feb 20, 2008 2:02 AM, Jarkko Laine <jarkko at jlaine.net> wrote:> > On 19.2.2008, at 20.45, James Deville wrote: > > > I set RAILS_ENV in my stories/helper.rb file. That might be a good > > solution. > > > > > > On Feb 19, 2008, at 10:32 AM, Ed Howland wrote: > > > >> Hi, > >> > >> I am trying to get Webrat integrated with RSpec. I''ve followed the > >> steps in the various blog posts about this, but have one sniggling > >> little issue. It might be a Webrat issue, but I am hoping the RSpec > >> folks might have already solved it. > >> > >> I have the stories run from a Rake task (am hoping for one of these > >> in the main rspec rake task soon,) ut to run webrat stuff in the > >> steps, you need to: > >> > >> rake spec:stories RAILS_ENV=test. > >> > >> The reason is due to the boot order of rake and plugins (of which > >> webrat and rspec are ones), webrat/init.rb doesn''t attach itself to > >> ActionController::Integration::Session unless it is on the test > >> environment. Only setting the RAILS_ENV ahead of the boot sequence > >> fixes this. But I am wondering if there is another alternative. > >> > >> Also, has anyone gotten it to run with autotest? > > Using Webrat for 100% of my stories (and running autotest) and loving > it. I also have the env set in stories/helper.rb, but I''m not sure > whether it was there from the beginning (I just copied it from some of > the early posts about stories).This is set in the generated stories/helper.rb (when you run ''script/generate rspec''). Cheers, David> > //jarkko > > -- > Jarkko Laine > http://jlaine.net > http://dotherightthing.com > http://www.railsecommerce.com > http://odesign.fi > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Ed Howland
2008-Feb-22 23:02 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
On Wed, Feb 20, 2008 at 1:02 AM, Jarkko Laine <jarkko at jlaine.net> wrote:> > On 19.2.2008, at 20.45, James Deville wrote: > > > I set RAILS_ENV in my stories/helper.rb file. That might be a good > > solution. > > > > > > Using Webrat for 100% of my stories (and running autotest) and loving > it. I also have the env set in stories/helper.rb, but I''m not sure > whether it was there from the beginning (I just copied it from some of > the early posts about stories). > > //jarkko >It is set in stories/helper.rb, but not working. ./script/generate rspec creates a file with: ENV[''RAILS_ENV'']="test" which is deprecated It should be: RAILS_ENV="test" Changed that and it all worked fine. Ed> -- > Jarkko Laine > http://jlaine.net > http://dotherightthing.com > http://www.railsecommerce.com > http://odesign.fi > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Ed Howland http://greenprogrammer.blogspot.com "The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, confidential and/or legally privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers."
Joe Van Dyk
2008-Feb-23 02:00 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
On Tue, Feb 19, 2008 at 11:02 PM, Jarkko Laine <jarkko at jlaine.net> wrote:> > On 19.2.2008, at 20.45, James Deville wrote: > > > I set RAILS_ENV in my stories/helper.rb file. That might be a good > > solution. > > > > > > On Feb 19, 2008, at 10:32 AM, Ed Howland wrote: > > > >> Hi, > >> > >> I am trying to get Webrat integrated with RSpec. I''ve followed the > >> steps in the various blog posts about this, but have one sniggling > >> little issue. It might be a Webrat issue, but I am hoping the RSpec > >> folks might have already solved it. > >> > >> I have the stories run from a Rake task (am hoping for one of these > >> in the main rspec rake task soon,) ut to run webrat stuff in the > >> steps, you need to: > >> > >> rake spec:stories RAILS_ENV=test. > >> > >> The reason is due to the boot order of rake and plugins (of which > >> webrat and rspec are ones), webrat/init.rb doesn''t attach itself to > >> ActionController::Integration::Session unless it is on the test > >> environment. Only setting the RAILS_ENV ahead of the boot sequence > >> fixes this. But I am wondering if there is another alternative. > >> > >> Also, has anyone gotten it to run with autotest? > > Using Webrat for 100% of my stories (and running autotest) and loving > it. I also have the env set in stories/helper.rb, but I''m not sure > whether it was there from the beginning (I just copied it from some of > the early posts about stories).How are you using both autotest and the stories?
Jarkko Laine
2008-Feb-23 08:11 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
On 23.2.2008, at 4.00, Joe Van Dyk wrote:> How are you using both autotest and the stories?I use Geoffrey''s rstakeout (http://nubyonrails.com/articles/automation-with-rstakeout ) to watch a single story (running all stories a la autotest is too slow) and /app, and autotest in a different terminal for normal specs. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://rubyforge.org/pipermail/rspec-users/attachments/20080223/3dc6853f/attachment-0001.bin
Ed Howland
2008-Feb-28 20:24 UTC
[rspec-users] Webrat integration with Rspec and Rake tasks
> > It is set in stories/helper.rb, but not working. ./script/generate > rspec creates a file with: > ENV[''RAILS_ENV'']="test" > > which is deprecated It should be: > RAILS_ENV="test" > > Changed that and it all worked fine. > > Edwhich then promptly broke migrations and other Rakeish things. I don''t have a solution that works for both yet, so I an commenting and un commenting this as needed. Ed -- Ed Howland http://greenprogrammer.blogspot.com