require File.dirname(__FILE__) + '/../spec_helper' describe StatusesController, :type => :controller do integrate_views describe '#show' do before { get :show } specify { response.should be_success } specify { response.should render_template(:show) } context 'given .txt format' do context 'successful response' do before do subject.should_receive(:diagnostic_status).and_return(:passed) end before { get :show, :format => 'txt' } specify { response.should be_success } specify { response.body.should == 'PASS' } end context 'failed response' do before do subject.should_receive(:diagnostic_status).and_return(:failed) end before { get :show, :format => 'txt' } specify { response.should be_error } specify { response.body.should == 'FAIL' } end end end end