You're going to have to get a little clever here:
it "should test the conversation message" do
Conversation.should_receive(:start).with(
instance_of(Customer),
instance_of(Venue),
"your order has been received and will be ready shortly.",
{:from_system => true}
).and_call_original
message_instance.order_now.join
end
Basically, you can test that you call your Conversation::start
with the right parameters. However, there's a subtlety here - you call message_instance.order_now.join
, because order_now
returns the thread, and you want to wait for the thread to finish running before your rspec example finishes. #join
will block execution of the main thread until the referenced thread finishes running. Otherwise, it would be possible for the rspec example to finish running before the thread executes, resulting in a test failure.