I am new to rspec and started implementing it on my project yesterday.
I have followed the instructions and installed rspec gem and rspec
plugin into my project. I created couple of sample stories and tried
running the specs using spec command which worked fine, but when I
started using rake spec command it is loading development environment
instead of test environment. I tried to putting some STDOUT’s in
spec_helper.rb but it seems that this file is never interpreted. Am I
missing something? Please help, Thanks in advance.
I am new to rspec and started implementing it on my project
yesterday.
I have followed the instructions
What instructions?
and installed rspec gem and rspec
plugin into my project. I created couple of sample stories and tried
running the specs using spec command which worked fine, but when I
started using rake spec command it is loading development environment
instead of test environment. I tried to putting some STDOUT’s in
spec_helper.rb but it seems that this file is never interpreted.
created a test_spec.rb file which have sample stories
ruby script/generate rspec
rake spec
I have one initializer file for oracle_driver in initializers
directory which is set to not load in test environment. when I run rake
spec command this initializer is invoked and I see that the environment
is set to development but not test.
To answer your second questions, I am not including it from my spec
files.
BTW I am using rpsec 1.1.4 and rails 2.1.0. Sorry for not being
elaborate in my prev post.
I am new to rspec and started implementing it on my project
yesterday.
I have followed the instructions
What instructions?
and installed rspec gem and rspec
plugin into my project. I created couple of sample stories and tried
running the specs using spec command which worked fine, but when I
started using rake spec command it is loading development environment
instead of test environment. I tried to putting some STDOUT’s in
spec_helper.rb but it seems that this file is never interpreted.
Yes I think that is what’s happening in my case. is this how it is
supposed to work? or can we have rspec ignore the step to look at
development environment. thanks so much for all your help.
iirc, it looks at the development environment to prepare the db
schema, but still runs the specs in test. Is that what you’re seeing?
Yes I think that is what’s happening in my case. is this how it is
supposed to work? or can we have rspec ignore the step to look at
development environment. thanks so much for all your help.
you’ll notice that vendor/plugins/rspec-rails/rspec.rake contains the
line
created a test_spec.rb file which have sample stories
ruby script/generate rspec
rake spec
I have one initializer file for oracle_driver in initializers
directory which is set to not load in test environment. when I run rake
spec command this initializer is invoked and I see that the environment
is set to development but not test.
To answer your second questions, I am not including it from my spec
files.
I’d recommend doing so if you want the spec_helper.rb file to be
loaded. It will set the environment for you correctly.
I know this thread is long dead, but I’m finding that I have the same
problem. ‘rake spec:modles’ loads the development environment and
clobbers my development database. I have to run set RAILS_ENV=test in
order for the tests to run correctly.
Commenting out that rake task line does not solve the problem. WHat’s
going on? Do I really have to remember to always set the environment to
test? Shouldn’t that be the default?
note, I ran into this wanting to run through my specs on my
production server, which doesnt have a development environment but
does have a production one. So instead I run (via a cap deploy:spec
task i wrote)
rake spec RAILS_ENV=production
that way the db:test:prepare uses the production db rather than the
development one
On Wed, May 13, 2009 at 9:59 PM, Matthew I. [email protected]
wrote:
I know this thread is long dead, but I’m finding that I have the same
problem. ‘rake spec:modles’ loads the development environment and
clobbers my development database. I have to run set RAILS_ENV=test in
order for the tests to run correctly.
Commenting out that rake task line does not solve the problem.
On Tue, Aug 19, 2008 at 2:35 PM, Jonathan L. [email protected]wrote:
rake spec RAILS_ENV=production
that way the db:test:prepare uses the production db rather than the
development one
I know this thread is long dead but … you must be joking.
///ark
I went though same experience today with my recently setup ruby 1.9,
rails 3.0, and rspec 2. “$ rake spec” loaded development environment,
hitting development db and pumping logs at log/development.log. This
caused lot of confusion in my testing (As I run spec within RubyMine at
the same time).
I found that there is “RAILS_ENV=development” in my bash environment.
Once I remove that, everything works as expected. rspec loads test
environment, test db, and logging at log/test.log.
One thing I noticed is when I have RAILS_ENV=development, even if I
tried “$ rake spec RAILS_ENV=test”, it actually hit development
environment. I thought argument override shell env setting. Am I wrong
or is it rspec issue?
This thread has been dead for awhile, but I’m having the same issue. I
don’t have a bash variable set. I’m also having this issue with
Cucumber. It always runs in development mode.
If I put “p Rails.env” in spec_helper.rb:8 (after spec_helper already
declares ENV[“RAILS_ENV”] ||= “test”) and run “rake spec” it outputs
“development” every time. If I run “spec spec/*/**” it outputs “test”
like it should.