Fix workers tests

This commit is contained in:
Piotr Sarnacki 2013-01-24 14:37:05 +01:00
parent 9ced671da5
commit 36c40da55d
2 changed files with 8 additions and 6 deletions

View File

@ -4,8 +4,8 @@ describe 'Workers' do
before(:each) do before(:each) do
Time.stubs(:now).returns(Time.utc(2011, 11, 11, 11, 11, 11)) Time.stubs(:now).returns(Time.utc(2011, 11, 11, 11, 11, 11))
@workers = [ @workers = [
Factory(:worker, :name => 'worker-1', :state => :working), Worker.new('1', full_name: 'ruby1:ruby1.travis-ci.org'),
Factory(:worker, :name => 'worker-2', :state => :errored) Worker.new('2', full_name: 'ruby2:ruby1.travis-ci.org')
] ]
end end
@ -14,8 +14,9 @@ describe 'Workers' do
attr_reader :workers attr_reader :workers
it 'GET /workers' do it 'GET /workers' do
Worker.stubs(all: @workers)
response = get '/workers', {}, headers response = get '/workers', {}, headers
response.should deliver_json_for(Worker.order(:host, :name), version: 'v1') response.should deliver_json_for(@workers, version: 'v1', type: 'workers')
end end
end end

View File

@ -4,8 +4,8 @@ describe 'Workers' do
before(:each) do before(:each) do
Time.stubs(:now).returns(Time.utc(2011, 11, 11, 11, 11, 11)) Time.stubs(:now).returns(Time.utc(2011, 11, 11, 11, 11, 11))
@workers = [ @workers = [
Factory(:worker, :name => 'worker-1', :state => :working), Worker.new('1', full_name: 'ruby1:ruby1.travis-ci.org'),
Factory(:worker, :name => 'worker-2', :state => :errored) Worker.new('2', full_name: 'ruby2:ruby1.travis-ci.org')
] ]
end end
@ -14,8 +14,9 @@ describe 'Workers' do
attr_reader :workers attr_reader :workers
it 'GET /workers' do it 'GET /workers' do
Worker.stubs(all: @workers)
response = get '/workers', {}, headers response = get '/workers', {}, headers
response.should deliver_json_for(Worker.order(:host, :name), version: 'v2') response.should deliver_json_for(@workers, version: 'v2', type: 'workers')
end end
end end