diff options
| author | Lin Jen-Shin <godfat@godfat.org> | 2016-07-15 15:30:26 +0800 |
|---|---|---|
| committer | Lin Jen-Shin <godfat@godfat.org> | 2016-07-15 15:30:26 +0800 |
| commit | 0f7851b7beb868511d7208a8170be905aecc731b (patch) | |
| tree | 83612a416b8d62cb52e80def25fcb6d6393ea287 /spec/models/commit_status_spec.rb | |
| parent | abd7943636715b0ea4c861135a02db97b6bcfb7e (diff) | |
| parent | bdb6f1e6fa756ae0db57e0474706685b6115c1e1 (diff) | |
| download | gitlab-ce-0f7851b7beb868511d7208a8170be905aecc731b.tar.gz | |
Merge remote-tracking branch 'upstream/master' into new-issue-by-email
* upstream/master: (1547 commits)
Add margin between buttons if both retry and cancel are present
Add margin between labels; remove underline hover style on status button
udpated JS based on feedback
Use default cursor for table header of project files (!5165)
Fix duplicated entry in changelog [ci skip]
Improves left static sidebar behaviour
Include default callback URL (OAuth)
Cleanup feature proposal template
Simplify regex for string-based multi-word label surrounded in quotes
Revert "Merge branch '18193-developers-can-merge' into 'master'
"
Upgrade Rails from 4.2.6 to 4.2.7.
some JS magic to fix empty URL bug
formats my test properly
Update CHANGELOG
Doesn't match empty label references surrounded in quotes
Fix markdown rendering for label references that contains `.`
Fix markdown rendering for label references that begin with a digit
Fix markdown rendering for consecutive label references
Stub omniauth provider for GitLab
Update CHANGELOG
...
Diffstat (limited to 'spec/models/commit_status_spec.rb')
| -rw-r--r-- | spec/models/commit_status_spec.rb | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 8fb605fff8a..05f22c7a9eb 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -1,8 +1,13 @@ require 'spec_helper' describe CommitStatus, models: true do - let(:pipeline) { FactoryGirl.create :ci_pipeline } - let(:commit_status) { FactoryGirl.create :commit_status, pipeline: pipeline } + let(:project) { create(:project) } + + let(:pipeline) do + create(:ci_pipeline, project: project, sha: project.commit.id) + end + + let(:commit_status) { create(:commit_status, pipeline: pipeline) } it { is_expected.to belong_to(:pipeline) } it { is_expected.to belong_to(:user) } @@ -13,20 +18,20 @@ describe CommitStatus, models: true do it { is_expected.to delegate_method(:sha).to(:pipeline) } it { is_expected.to delegate_method(:short_sha).to(:pipeline) } - + it { is_expected.to respond_to :success? } it { is_expected.to respond_to :failed? } it { is_expected.to respond_to :running? } it { is_expected.to respond_to :pending? } - describe :author do + describe '#author' do subject { commit_status.author } before { commit_status.author = User.new } it { is_expected.to eq(commit_status.user) } end - describe :started? do + describe '#started?' do subject { commit_status.started? } context 'without started_at' do @@ -52,7 +57,7 @@ describe CommitStatus, models: true do end end - describe :active? do + describe '#active?' do subject { commit_status.active? } %w(pending running).each do |state| @@ -72,7 +77,7 @@ describe CommitStatus, models: true do end end - describe :complete? do + describe '#complete?' do subject { commit_status.complete? } %w(success failed canceled).each do |state| @@ -92,7 +97,7 @@ describe CommitStatus, models: true do end end - describe :duration do + describe '#duration' do subject { commit_status.duration } it { is_expected.to eq(120.0) } @@ -116,8 +121,8 @@ describe CommitStatus, models: true do it { is_expected.to be > 0.0 } end end - - describe :latest do + + describe '.latest' do subject { CommitStatus.latest.order(:id) } before do @@ -133,7 +138,7 @@ describe CommitStatus, models: true do end end - describe :running_or_pending do + describe '.running_or_pending' do subject { CommitStatus.running_or_pending.order(:id) } before do @@ -198,4 +203,10 @@ describe CommitStatus, models: true do end end end + + describe '#commit' do + it 'returns commit pipeline has been created for' do + expect(commit_status.commit).to eq project.commit + end + end end |
