Commit 7d883994 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix tests related to detailed statuses and permissions

[ci skip]
parent 9c0a8cb5
require 'spec_helper'
describe Gitlab::Ci::Status::Canceled do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'canceled' }
......
require 'spec_helper'
describe Gitlab::Ci::Status::Created do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'created' }
......@@ -14,8 +16,4 @@ describe Gitlab::Ci::Status::Created do
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_created' }
end
describe '#title' do
it { expect(subject.title).to eq 'Double: created' }
end
end
......@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Extended do
end
it 'requires subclass to implement matcher' do
expect { subject.matches?(double) }
expect { subject.matches?(double, double) }
.to raise_error(NotImplementedError)
end
end
......@@ -2,15 +2,17 @@ require 'spec_helper'
describe Gitlab::Ci::Status::Factory do
subject do
described_class.new(object)
described_class.new(resource, user)
end
let(:user) { create(:user) }
let(:status) { subject.fabricate! }
context 'when object has a core status' do
HasStatus::AVAILABLE_STATUSES.each do |core_status|
context "when core status is #{core_status}" do
let(:object) { double(status: core_status) }
let(:resource) { double(status: core_status) }
it "fabricates a core status #{core_status}" do
expect(status).to be_a(
......
require 'spec_helper'
describe Gitlab::Ci::Status::Failed do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'failed' }
......@@ -14,8 +16,4 @@ describe Gitlab::Ci::Status::Failed do
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_failed' }
end
describe '#title' do
it { expect(subject.title).to eq 'Double: failed' }
end
end
require 'spec_helper'
describe Gitlab::Ci::Status::Pending do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'pending' }
......@@ -14,8 +16,4 @@ describe Gitlab::Ci::Status::Pending do
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_pending' }
end
describe '#title' do
it { expect(subject.title).to eq 'Double: pending' }
end
end
require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::Common do
let(:user) { create(:user) }
let(:pipeline) { create(:ci_pipeline) }
subject do
Class.new(Gitlab::Ci::Status::Core)
.new(pipeline).extend(described_class)
.new(pipeline, user)
.extend(described_class)
end
it 'does not have action' do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::Factory do
let(:user) { create(:user) }
subject do
described_class.new(pipeline)
described_class.new(pipeline, user)
end
let(:status) do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::SuccessWithWarnings do
subject do
described_class.new(double('status'))
described_class.new(double('status'), double('user'))
end
describe '#test' do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Running do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'running' }
......@@ -14,8 +16,4 @@ describe Gitlab::Ci::Status::Running do
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_running' }
end
describe '#title' do
it { expect(subject.title).to eq 'Double: running' }
end
end
require 'spec_helper'
describe Gitlab::Ci::Status::Skipped do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'skipped' }
......@@ -14,8 +16,4 @@ describe Gitlab::Ci::Status::Skipped do
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_skipped' }
end
describe '#title' do
it { expect(subject.title).to eq 'Double: skipped' }
end
end
require 'spec_helper'
describe Gitlab::Ci::Status::Stage::Common do
let(:user) { create(:user) }
let(:pipeline) { create(:ci_empty_pipeline) }
let(:stage) { build(:ci_stage, pipeline: pipeline, name: 'test') }
let(:stage) do
build(:ci_stage, pipeline: pipeline, name: 'test')
end
subject do
Class.new(Gitlab::Ci::Status::Core)
.new(stage).extend(described_class)
.new(stage, user).extend(described_class)
end
it 'does not have action' do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Stage::Factory do
let(:user) { create(:user) }
let(:pipeline) { create(:ci_empty_pipeline) }
let(:stage) { build(:ci_stage, pipeline: pipeline, name: 'test') }
let(:stage) do
build(:ci_stage, pipeline: pipeline, name: 'test')
end
subject do
described_class.new(stage)
described_class.new(stage, user)
end
let(:status) do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Success do
subject { described_class.new(double('subject')) }
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.label).to eq 'passed' }
......@@ -14,8 +16,4 @@ describe Gitlab::Ci::Status::Success do
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_success' }
end
describe '#title' do
it { expect(subject.title).to eq 'Double: passed' }
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