If your specs failed, maybe that's why nothing after Rake::Task["spec"].execute
gets executed. Instead of using the Rakefile, why not use Rspec's before(:suite)
and after(:suite)
hooks? You can put that code in your spec_helper.rb
if you have one.
Is there a way to hook a before and after suite, in a Rakefile?
Question
My current Rakefile looks like this:
# ...
task :test do
# build testing environment
RSpec::Core::RakeTask.new(:spec) do |t|
# ...
end
Rake::Task["spec"].execute
# remove testing environment
end
Unfortunately this does not execute anything after Rake::Task["spec"].execute
for some reasons that I can't possibly conceive.
So, is there a way to specify something to execute before and after the test suite runs, within the Rakefile?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow