spec/rake/funnel/tasks/timing_spec.rb in rake-funnel-0.18.0 vs spec/rake/funnel/tasks/timing_spec.rb in rake-funnel-0.19.0
- old
+ new
@@ -1,23 +1,23 @@
include Rake
describe Rake::Funnel::Tasks::Timing do
include DSL
- before {
+ before do
Rake.application = nil
Task.clear
expect(define_tasks).to be
expect(subject).to be
- }
+ end
let(:define_tasks) { task :task }
- after {
+ after do
subject.reset!
- }
+ end
describe 'defaults' do
its(:name) { should == :timing }
its(:stats) { should have(0).items }
end
@@ -50,11 +50,11 @@
end
end
end
describe 'execution' do
- before {
+ before do
allow(Rake.application).to receive(:init)
allow(Rake.application).to receive(:load_rakefile)
Rake.application.top_level_tasks.unshift(:task)
allow(Rake.application).to receive(:exit_because_of_exception)
@@ -62,18 +62,18 @@
allow($stderr).to receive(:puts)
# The 'rake aborted!' message is #printed on $stderr.
allow($stderr).to receive(:print)
Rake.application.run
- }
+ end
context 'with task defined' do
- let(:define_tasks) {
+ let(:define_tasks) do
task :task do
puts 'hello'
end
- }
+ end
it 'should execute tasks' do
expect($stdout).to have_received(:puts).with('hello')
end
@@ -90,14 +90,14 @@
expect(subject.stats.reverse_each.first[:task].name).to eq('timing')
end
end
context 'with unreachable task defined' do
- let(:define_tasks) {
+ let(:define_tasks) do
task :task
task :not_executed
- }
+ end
it 'should not record timing information for unexecuted tasks' do
expect(subject.stats.map { |s| s[:task].name }).not_to include('not_executed')
end
end
@@ -112,14 +112,14 @@
expect($stdout).to have_received(:puts).with(/Status\s+OK/)
end
end
context 'when rake failed' do
- let(:define_tasks) {
+ let(:define_tasks) do
task :task do
raise
end
- }
+ end
it 'should print the report' do
expect($stdout).to have_received(:puts).with(/Build time report/)
end