it "Should send the calls mp3 file" do
File.should_receive(:exist?).with("#{RAILS_ROOT}/public/audio/call_#{@call.id}.mp3").and_return(true)
controller.should_receive(:send_file).with("/foo.mp3", anything())
get :listen, :id => "1"
assigns.should have_key(:call)
assigns[:call].should equal(@call)
end
my reimplementation based on that spec
def listen
@call = something something params[:id]
path = File.join(#{RAILS_ROOT}, "public", "audio", "call_#{@call.id}.mp3")
if File.exist?(path)
send_file(path)
end
end