Commit 28ce41c0 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix tests

parent 433ca739
...@@ -110,7 +110,7 @@ class CommitStatus < ActiveRecord::Base ...@@ -110,7 +110,7 @@ class CommitStatus < ActiveRecord::Base
elsif started_at elsif started_at
Time.now - started_at Time.now - started_at
end end
duration.to_i duration
end end
def stuck? def stuck?
......
...@@ -13,7 +13,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps ...@@ -13,7 +13,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end end
step 'I should see "Shop" project CI status' do step 'I should see "Shop" project CI status' do
expect(page).to have_link "Build: skipped" expect(page).to have_link "Build skipped"
end end
step 'I should see last push widget' do step 'I should see last push widget' do
......
...@@ -355,7 +355,8 @@ describe Ci::Commit, models: true do ...@@ -355,7 +355,8 @@ describe Ci::Commit, models: true do
end end
context 'update state' do 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 before do
build build
...@@ -368,4 +369,28 @@ describe Ci::Commit, models: true do ...@@ -368,4 +369,28 @@ describe Ci::Commit, models: true do
end end
end 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 end
...@@ -232,28 +232,4 @@ describe CommitStatus, models: true do ...@@ -232,28 +232,4 @@ describe CommitStatus, models: true do
end end
end 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment