diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-03 11:58:08 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-03 12:50:51 +0200 |
commit | d8c4556d3c8623bf48e689f3734c9c35cda34c2f (patch) | |
tree | 007c4f7193aed88be62610c77aa1a172097be6a4 /spec/models | |
parent | a21d084ded6cdf5b83163d4d72bb5c636218d091 (diff) | |
download | gitlab-ce-d8c4556d3c8623bf48e689f3734c9c35cda34c2f.tar.gz |
Refactor code reponsible for creating builds
This removes duplications and extracts method that builds build-jobs
without persisting those objects, to a separate method.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/commit_spec.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb index a4549d40461..01d931b087e 100644 --- a/spec/models/ci/commit_spec.rb +++ b/spec/models/ci/commit_spec.rb @@ -55,15 +55,11 @@ describe Ci::Commit, models: true do let!(:commit) { FactoryGirl.create :ci_commit, project: project, ref: 'master', tag: false } def create_builds(trigger_request = nil) - if commit.create_builds(nil, trigger_request) - commit.save - end + commit.create_builds(nil, trigger_request) end def create_next_builds - if commit.create_next_builds(commit.builds.order(:id).last) - commit.save - end + commit.create_next_builds(commit.builds.order(:id).last) end it 'creates builds' do |