Displaying 2 results from an estimated 2 matches for "should_not_be_run".
2007 Jan 25
0
mocking methods that receive blocks - back to mocking Thread again
...do
@runner.should_be_running
end
@runner.execute(@task)
end
specify "should not be running after the task has been executed" do
Thread.should_receive(:new).with(@task).and_return do |task, block|
block.call(task)
@runner.should_not_be_running
end
@runner.execute(@task)
end
end
2007 Jan 21
1
A Thread / Mock question
...t; do
task = SampleTask.new
task.should_receive(:run) do
@runner.should_be_running
end
@runner.execute(task)
end
specify "should not be running after the task has been executed" do
@runner.execute(SampleTask.new)
@runner.should_not_be_running
end
end
I don''t want to have real threads in the specs, so I mocked the Thread
class to just execute the passed block within the main thread. In the
first specification I also mock the run method of the task to check
within that method, if the TaskRunner correctly indicates it'...