Fixed: save #started_at at starting of build

This commit is contained in:
Vokhmin Alexey V 2014-08-20 22:16:15 +04:00
parent 50c329abaa
commit 6fb8fb92c4
2 changed files with 13 additions and 3 deletions

View File

@ -9,14 +9,14 @@ module BuildListObserver
def update_average_build_time
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,
self.class::SUCCESS,
self.class::BUILD_CANCELING,
self.class::TESTS_FAILED,
self.class::BUILD_CANCELED].include? status
# 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
# Update project average build time

View File

@ -1,5 +1,15 @@
require 'spec_helper'
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