summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 1688e91ca62..becc743de31 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -443,7 +443,20 @@ describe Project, models: true do
let(:project) { create :project }
let(:commit) { create :ci_commit, project: project, ref: 'master' }
- it { expect(project.ci_commit(commit.sha, 'master')).to eq(commit) }
+ subject { project.ci_commit(commit.sha, 'master') }
+
+ it { is_expected.to eq(commit) }
+
+ context 'return latest' do
+ let(:commit2) { create :ci_commit, project: project, ref: 'master' }
+
+ before do
+ commit
+ commit2
+ end
+
+ it { is_expected.to eq(commit2) }
+ end
end
describe :builds_enabled do