Fixed: save #started_at at starting of build
This commit is contained in:
parent
50c329abaa
commit
6fb8fb92c4
|
@ -9,14 +9,14 @@ module BuildListObserver
|
||||||
|
|
||||||
def update_average_build_time
|
def update_average_build_time
|
||||||
if status_changed?
|
if status_changed?
|
||||||
started_at = Time.now if status == self.class::BUILD_STARTED
|
self.started_at = Time.now if status == self.class::BUILD_STARTED
|
||||||
if [self.class::BUILD_ERROR,
|
if [self.class::BUILD_ERROR,
|
||||||
self.class::SUCCESS,
|
self.class::SUCCESS,
|
||||||
self.class::BUILD_CANCELING,
|
self.class::BUILD_CANCELING,
|
||||||
self.class::TESTS_FAILED,
|
self.class::TESTS_FAILED,
|
||||||
self.class::BUILD_CANCELED].include? status
|
self.class::BUILD_CANCELED].include? status
|
||||||
# stores time interval beetwin build start and finish in seconds
|
# stores time interval beetwin build start and finish in seconds
|
||||||
duration = current_duration if started_at
|
duration = current_duration if self.started_at
|
||||||
|
|
||||||
if status == self.class::SUCCESS
|
if status == self.class::SUCCESS
|
||||||
# Update project average build time
|
# Update project average build time
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe BuildListObserver do
|
describe BuildListObserver do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
|
before { stub_symlink_methods }
|
||||||
|
|
||||||
|
let(:build_list) { FactoryGirl.create(:build_list) }
|
||||||
|
|
||||||
|
it 'updates started_at when build started' do
|
||||||
|
expect(build_list.started_at).to be_nil
|
||||||
|
build_list.start_build
|
||||||
|
expect(build_list.started_at).to_not be_nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue