diff options
| -rw-r--r-- | app/models/commit_status.rb | 2 | ||||
| -rw-r--r-- | features/steps/dashboard/dashboard.rb | 2 | ||||
| -rw-r--r-- | spec/models/ci/commit_spec.rb | 27 | ||||
| -rw-r--r-- | spec/models/commit_status_spec.rb | 24 |
4 files changed, 28 insertions, 27 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 24a26b4be8c..aa56314aa16 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -110,7 +110,7 @@ class CommitStatus < ActiveRecord::Base elsif started_at Time.now - started_at end - duration.to_i + duration end def stuck? diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index ba0e829dc0c..b5980b35102 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -13,7 +13,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'I should see "Shop" project CI status' do - expect(page).to have_link "Build: skipped" + expect(page).to have_link "Build skipped" end step 'I should see last push widget' do diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb index aef4f007202..c12327c2a77 100644 --- a/spec/models/ci/commit_spec.rb +++ b/spec/models/ci/commit_spec.rb @@ -355,7 +355,8 @@ describe Ci::Commit, models: true do end context 'update state' do - let(:build) { FactoryGirl.create :ci_build, :success, commit: commit, started_at: Time.now - 120, finished_at: Time.now - 60 } + let(:current) { Time.now.change(:usec => 0) } + let(:build) { FactoryGirl.create :ci_build, :success, commit: commit, started_at: current - 120, finished_at: current - 60 } before do build @@ -368,4 +369,28 @@ describe Ci::Commit, models: true do end end end + + describe '#branch?' do + subject { commit.branch? } + + context 'is not a tag' do + before do + commit.tag = false + end + + it 'return true when tag is set to false' do + is_expected.to be_truthy + end + end + + context 'is not a tag' do + before do + commit.tag = true + end + + it 'return false when tag is set to true' do + is_expected.to be_falsey + end + end + end end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 31d546820c2..971e6750375 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -232,28 +232,4 @@ describe CommitStatus, models: true do end end end - - describe '#branch?' do - subject { commit_status.branch? } - - context 'is not a tag' do - before do - commit_status.tag = false - end - - it 'return true when tag is set to false' do - is_expected.to be_truthy - end - end - - context 'is not a tag' do - before do - commit_status.tag = true - end - - it 'return false when tag is set to true' do - is_expected.to be_falsey - end - end - end end |
