search for: should_be_run

Displaying 2 results from an estimated 2 matches for "should_be_run".

2007 Jan 25
0
mocking methods that receive blocks - back to mocking Thread again
...ask).and_yield(@task) @task.should_receive(:run) @runner.execute(@task) end specify "should be running while a task is beeing executed" do Thread.should_receive(:new).with(@task).and_yield(@task) @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 Thread.should_receive(:new).with(@task).and_return do |task, block| block.call(task) @runner.should_not_be_running end...
2007 Jan 21
1
A Thread / Mock question
...; do setup do Thread.stub!(:new).and_return do |block| block.call end @runner = TaskRunner.new end specify "should be running when a task is executed" 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 th...