debian-mirror-gitlab/spec/lib/gitlab/ci/status/build/scheduled_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.3 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-12-05 23:21:45 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Ci::Status::Build::Scheduled do
2018-12-05 23:21:45 +05:30
let(:user) { create(:user) }
let(:project) { create(:project, :stubbed_repository) }
let(:build) { create(:ci_build, :scheduled, project: project) }
let(:status) { Gitlab::Ci::Status::Core.new(build, user) }
subject { described_class.new(status) }
describe '#illustration' do
it { expect(subject.illustration).to include(:image, :size, :title) }
end
describe '#status_tooltip' do
2018-12-13 13:39:08 +05:30
let(:build) { create(:ci_build, scheduled_at: 1.minute.since, project: project) }
2018-12-05 23:21:45 +05:30
2018-12-13 13:39:08 +05:30
it 'has a placeholder for the remaining time' do
expect(subject.status_tooltip).to include('%{remainingTime}')
2018-12-05 23:21:45 +05:30
end
end
describe '.matches?' do
subject { described_class.matches?(build, user) }
context 'when build is scheduled and scheduled_at is present' do
let(:build) { create(:ci_build, :expired_scheduled, project: project) }
it { is_expected.to be_truthy }
end
context 'when build is scheduled' do
let(:build) { create(:ci_build, status: :scheduled, project: project) }
it { is_expected.to be_falsy }
end
context 'when scheduled_at is present' do
let(:build) { create(:ci_build, scheduled_at: 1.minute.since, project: project) }
it { is_expected.to be_falsy }
end
end
end