debian-mirror-gitlab/spec/presenters/commit_status_presenter_spec.rb

44 lines
1.1 KiB
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe CommitStatusPresenter do
2018-10-15 14:42:47 +05:30
let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) }
subject(:presenter) do
described_class.new(build)
end
it 'inherits from Gitlab::View::Presenter::Delegated' do
expect(described_class.superclass).to eq(Gitlab::View::Presenter::Delegated)
end
2018-11-18 11:00:15 +05:30
describe 'covers all failure reasons' do
let(:message) { presenter.callout_failure_message }
CommitStatus.failure_reasons.keys.each do |failure_reason|
context failure_reason do
before do
build.failure_reason = failure_reason
end
it "is a valid status" do
expect { message }.not_to raise_error
end
end
end
context 'invalid failure message' do
before do
expect(build).to receive(:failure_reason) { 'invalid failure message' }
end
it "is an invalid status" do
expect { message }.to raise_error(/key not found:/)
end
end
end
2018-10-15 14:42:47 +05:30
end