I am using rvm, and when I try to do rake spec, I get:
“You have already activated rake 0.9.0, but your Gemfile requires rake
0.8.7.
Consider using bundle exec.”
… Is there a way to get around this so I don’t have to do bundle exec
rake spec each and every time?
Also, I tried throwing ‘debugger’ into one of my specs and I get:
“***** debugger statement ignored, use -d or --debug option to enable
debugging”
But I am not sure what is asking for the -d or --debug? Is it rake? Is
it
bundle? Neither rake nor bundle seem to like -d or --debug… So I am
totally
confused on this one…
On Jun 6, 2011, at 4:26 PM, Patrick J. Collins wrote:
“***** debugger statement ignored, use -d or --debug option to enable
debugging”
But I am not sure what is asking for the -d or --debug? Is it rake? Is it
bundle? Neither rake nor bundle seem to like -d or --debug… So I am totally
confused on this one…
rake doesn’t take arguments like that. Try ‘rspec spec --debugger’.
Hmm, that gives no output at all… I just get a bash prompt immediately
after entering ‘rake spec --debugger’
On 7 Jun 2011, at 03:06, Patrick J. Collins wrote:
rspec, not rake:
Oops! I missed that… So other than this debugger thing, are there any other
differences between rake spec and rspec spec?
Just a bit! They’re two completely different commands that run two
completely different computer programs.
Rake is a tool for running tasks of any nature, which you can invoke
with the command rake. If you run rake -T in your project, you’ll
see that rake spec is just one of many other tasks you can run that do
all kinds of things, not just to do with running tests.
RSpec is a tool for running BDD-style unit tests, which you can invoke
with the command rspec. If you run rspec --help you’ll see all the
options you could pass to the rspec command.
In the case of rake spec the spec part is the name of the Rake task
which runs your RSpec tests.
In the case of rspec spec the spec part is the folder where you want
the rspec program to look for tests to run.
On Jun 6, 2011, at 7:53 PM, Patrick J. Collins wrote:
rake doesn’t take arguments like that. Try ‘rspec spec --debugger’.
Hmm, that gives no output at all… I just get a bash prompt immediately
after entering ‘rake spec --debugger’
Rake is a tool for running tasks of any nature, which you can invoke with the
command rake. If you run rake -T in your project, you’ll see that rake spec
is just one of many other tasks you can run that do all kinds of things, not just
to do with running tests.
RSpec is a tool for running BDD-style unit tests, which you can invoke with the
command rspec. If you run rspec --help you’ll see all the options you could
pass to the rspec command.
Right… I just was wondering if the entire process of invoking RSpec to
run
all tests is identical between ‘rake spec’ and ‘spec rspec’
Which I am assuming by your answer that it is. Rake spec runs a task
that
probably just does: ‘spec rspec’ ?
On Jun 7, 2011, at 4:21 AM, Patrick J. Collins wrote:
Rake is a tool for running tasks of any nature, which you can invoke with the
command rake. If you run rake -T in your project, you’ll see that rake spec
is just one of many other tasks you can run that do all kinds of things, not just
to do with running tests.
RSpec is a tool for running BDD-style unit tests, which you can invoke with the
command rspec. If you run rspec --help you’ll see all the options you could
pass to the rspec command.
Right… I just was wondering if the entire process of invoking RSpec to run
all tests is identical between ‘rake spec’ and ‘spec rspec’
Which I am assuming by your answer that it is. Rake spec runs a task that
probably just does: ‘spec rspec’ ?
While that is the end result, they are still quite different. The ‘rake’
task loads resources it needs for all rake tasks, and then it shells out
to a separate process. In a Rails app, the rake task starts in the
development environment (as that is the default) and shells out to the
test environment. This means that you take the hit of loading up the
Rails environment twice when you run ‘rake spec’, whereas ‘rspec spec’
loads it once, and doesn’t load up the other things you need for other
rake tasks.
HTH,
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.