Sha256: b2ab5434b1f8fc8f9f522cce8635a89c7e5342e950148ca51f373dcb3ca10429
Contents?: true
Size: 1016 Bytes
Versions: 1
Compression:
Stored size: 1016 Bytes
Contents
require 'spec_helper' describe BeanstalkApi::JobsController do context '#show' do context 'Authorized calls' do before(:each) do @mock_pool = double("BeanstalkPool") @mock_connection = double("BeanstalkConnection") controller.stub(:pool).and_return(@mock_pool) controller.stub(:connection).and_return(@mock_connection) controller.stub(:restrict_access) controller.stub(:beanstalk_running) end it "should render the json of the job if the job was found" do mock_job = double("Job") @mock_pool.should_receive(:peek_job).with('2888').and_return(mock_job) @mock_connection.should_receive(:job_stats).with('2888').and_return({ 'id' => '1' }) controller.should_receive(:format_job).with(mock_job).and_return({ '1' => 'hello' }) get :show, id: '2888', use_route: :beanstalk_api expect(response.body).to eq('{"job":{"1":"hello"},"statistics":{"id":"1"}}') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pvdgm_beanstalk_api-0.1.0 | spec/controllers/jobs_controller_spec.rb |