summaryrefslogtreecommitdiff
path: root/spec/models/ci
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-18 07:35:43 -0400
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-18 07:35:43 -0400
commit28ce41c00ebba5b60c69f75d9bce97c11210779a (patch)
tree747d77bab7cf97c16498e4e6f79ed2427540cabb /spec/models/ci
parent433ca7390d800a2fda3e3c5eb29272d0ba2d9df6 (diff)
downloadgitlab-ce-28ce41c00ebba5b60c69f75d9bce97c11210779a.tar.gz
Fix tests
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/commit_spec.rb27
1 files changed, 26 insertions, 1 deletions
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