Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
找到了在 Sinatra 中运行单独进程的简单方法:在 Sinatra 中运行后台进程
get '/start_process' @@pid = Process.spawn('external_command_to_run') end
您将如何在 RSpec 中对此进行测试?
红宝石 1.9.3。
提取一个执行后台处理的类并对其进行单元测试。然后测试您的操作调用此类上的方法的期望
一些“伪代码”:
before do MyWorker.should_receive(:perform) end specify { get :something }