search for: task_to_execut

Displaying 1 result from an estimated 1 matches for "task_to_execut".

Did you mean: task_to_execute
2007 Jan 21
1
A Thread / Mock question
...9;s running status. So far this works, but maybe there is a better solution. Any suggestions? Is there a way to use the above mocking of Thread.new and pass a parameter to the block executed by the thread, like this?: def execute(task) @is_running = true Thread.new(task) do |task_to_execute| task_to_execute.run @is_running = false end end How can RSpec mock Thread.new in this case? Maybe I should introduce some kind of ThreadFactory that creates instances of TestableThread for the specifications. bye, Tobias