blob: 5e3e1f9c304e7de29e58265e87a61a328c022718 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Onboarding::LearnGitlab do
let_it_be(:current_user) { create(:user) }
let_it_be(:learn_gitlab_project) { create(:project, name: described_class::PROJECT_NAME) }
let_it_be(:learn_gitlab_board) { create(:board, project: learn_gitlab_project, name: described_class::BOARD_NAME) }
let_it_be(:learn_gitlab_label) { create(:label, project: learn_gitlab_project, name: described_class::LABEL_NAME) }
before do
learn_gitlab_project.add_developer(current_user)
end
describe '#available?' do
using RSpec::Parameterized::TableSyntax
where(:project, :board, :label, :expected_result) do
nil | nil | nil | nil
nil | nil | true | nil
nil | true | nil | nil
nil | true | true | nil
true | nil | nil | nil
true | nil | true | nil
true | true | nil | nil
true | true | true | true
end
with_them do
before do
allow_next_instance_of(described_class) do |learn_gitlab|
allow(learn_gitlab).to receive(:project).and_return(project)
allow(learn_gitlab).to receive(:board).and_return(board)
allow(learn_gitlab).to receive(:label).and_return(label)
end
end
subject { described_class.new(current_user).available? }
it { is_expected.to be expected_result }
end
end
describe '#project' do
subject { described_class.new(current_user).project }
it { is_expected.to eq learn_gitlab_project }
context 'when it is created during trial signup' do
let_it_be(:learn_gitlab_project) do
create(:project, name: described_class::PROJECT_NAME_ULTIMATE_TRIAL, path: 'learn-gitlab-ultimate-trial')
end
it { is_expected.to eq learn_gitlab_project }
end
end
describe '#board' do
subject { described_class.new(current_user).board }
it { is_expected.to eq learn_gitlab_board }
end
describe '#label' do
subject { described_class.new(current_user).label }
it { is_expected.to eq learn_gitlab_label }
end
end
|