[rspec-users] RSpec-rails 1.2.2: autospec passes but "rake spec" fails

Tadatoshi Takahashi lists at ruby-forum.com
Fri Mar 27 16:50:16 EDT 2009


Stephen Eley wrote:
> On Fri, Mar 27, 2009 at 8:36 AM, David Chelimsky <dchelimsky at gmail.com> 
> wrote:
>>
>> You can also change spec_helper.rb to force the test environment with:
>> �ENV["RAILS_ENV"] = 'test'
>> That's what it used to do but somebody complained that it shouldn't
>> force an environment :)
> 
> Yeah.  Running tests in the 'test' environment?  What were you
> thinking?  That's almost as ridiculous as expecting the 'rails'
> command to create a Rails app!  >%-\
> 
> It might be that your positive comment on my Lighthouse ticket
> yesterday is going to my head, but it seems to me that the arrow of
> work here is backwards.  The reason for having a generated skeleton,
> including spec_helper.rb, is to give people sensible starter code with
> defaults for sensible cases.  99% of Rails users are going to want to
> run their Rspec behaviors in 'test' every time.  Setting the
> environment to 'test' is therefore sensible.
> 
> People with edge cases are more likely to know what they're doing, and
> should know that they can change that one line to add the '||=' or
> comment it out completely.  The people who are most likely to be
> impacted by the less forceful spec_helper are probably newer users who
> don't understand shells and environments quite as well, and might be
> running in 'one-click' Rails setups that set the environment for them
> without them knowing about it.
> 
> 
> --
> Have Fun,
>    Steve Eley (sfeley at gmail.com)
>    ESCAPE POD - The Science Fiction Podcast Magazine
>    http://www.escapepod.org


Thank you, David, Steve.

About Steve's comment,
I may not be familiar with everything in Ruby on Rails but I am willing 
to learn.
And I would like to know in which case it would be better to run RSpec 
in an environment other than test one.
To me, I like clear separation of development, test, and production 
environment in Ruby on Rails.
And I like to run Specs in test environment because for every run of a 
spec (example), database is cleaned up and doesn't affect the result of 
running the next spec (example). And I don't want the development 
database to be cleaned up by running RSpec against it.
But that's only my understanding.
If anybody could give me more insight about it, I would greatly 
appreciate it.

Thank you.

Tadatoshi
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list