This commit is contained in:
Vokhmin Alexey V 2015-05-22 23:31:43 +03:00
parent 95d5f4a384
commit ae572b96d8
3 changed files with 33 additions and 37 deletions

View File

@ -37,7 +37,7 @@ module BuildListObserver
end end
build_count = statistic.build_count.to_i build_count = statistic.build_count.to_i
new_av_time = ( statistic.average_build_time * build_count + duration.to_i ) / ( build_count + 1 ) new_av_time = ( statistic.average_build_time * build_count + duration.to_i ) / ( build_count + 1 )
statistic.update_attributes({average_build_time: new_av_time, build_count: build_count + 1}, without_protection: true) statistic.update_attributes(average_build_time: new_av_time, build_count: build_count + 1)
end end
end end
end end

View File

@ -17,7 +17,6 @@ module Feed::Comment
if can_notify_on_new_comment?(subscribe) if can_notify_on_new_comment?(subscribe)
UserMailer.new_comment_notification(self, subscribe.user_id).deliver unless own_comment?(subscribe.user) UserMailer.new_comment_notification(self, subscribe.user_id).deliver unless own_comment?(subscribe.user)
ActivityFeed.create( ActivityFeed.create(
{
user_id: subscribe.user_id, user_id: subscribe.user_id,
kind: 'new_comment_notification', kind: 'new_comment_notification',
project_owner: project.owner_uname, project_owner: project.owner_uname,
@ -32,7 +31,6 @@ module Feed::Comment
project_id: commentable.project.id, project_id: commentable.project.id,
comment_id: id comment_id: id
} }
}, without_protection: true
) )
end end
end end
@ -46,7 +44,6 @@ module Feed::Comment
UserMailer.new_comment_notification(self, subscribe.user_id).deliver UserMailer.new_comment_notification(self, subscribe.user_id).deliver
end end
ActivityFeed.create( ActivityFeed.create(
{
user_id: subscribe.user_id, user_id: subscribe.user_id,
kind: 'new_comment_commit_notification', kind: 'new_comment_commit_notification',
project_owner: project.owner_uname, project_owner: project.owner_uname,
@ -62,7 +59,6 @@ module Feed::Comment
project_id: project.id, project_id: project.id,
comment_id: id comment_id: id
} }
}, without_protection: true
) )
end end
end end

View File

@ -191,8 +191,8 @@ describe BuildList do
auto_publish_status: BuildList::AUTO_PUBLISH_STATUS_DEFAULT, auto_publish_status: BuildList::AUTO_PUBLISH_STATUS_DEFAULT,
project: project project: project
) )
bl.update_attributes({commit_hash: bl.project.repo.commits('master').last.id, bl.update_attributes(commit_hash: bl.project.repo.commits('master').last.id,
status: BuildList::BUILD_PUBLISH}, without_protection: true) status: BuildList::BUILD_PUBLISH)
bl.published bl.published
expect(subject.count).to eq 1 expect(subject.count).to eq 1
end end
@ -287,7 +287,7 @@ describe BuildList do
let(:build_list) { FactoryGirl.create(:build_list) } let(:build_list) { FactoryGirl.create(:build_list) }
before do before do
build_list.update_attributes({ status: BuildList::SUCCESS }, without_protection: true) build_list.update_attributes(status: BuildList::SUCCESS)
allow(build_list).to receive(:valid_branch_for_publish?).and_return(true) allow(build_list).to receive(:valid_branch_for_publish?).and_return(true)
end end
@ -315,7 +315,7 @@ describe BuildList do
let(:build_list) { FactoryGirl.create(:build_list) } let(:build_list) { FactoryGirl.create(:build_list) }
before do before do
build_list.update_attributes({ status: BuildList::SUCCESS }, without_protection: true) build_list.update_attributes(status: BuildList::SUCCESS)
end end
it 'returns true for eligible build' do it 'returns true for eligible build' do