Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-02-05 16:33:49 +0300
committerMatija Čupić <matteeyah@gmail.com>2018-02-05 16:33:49 +0300
commita85b85e1d8e6a482af7d13477068e6ab976c4b25 (patch)
tree393e9e6d733ef43acb2517f277219f28ba5e0d9f /spec/helpers/user_callouts_helper_spec.rb
parentc1e1f8070b5f41731bea4dab936690382bfb486e (diff)
Refactor .show_gke_cluster_integration_callout?
Diffstat (limited to 'spec/helpers/user_callouts_helper_spec.rb')
-rw-r--r--spec/helpers/user_callouts_helper_spec.rb28
1 files changed, 10 insertions, 18 deletions
diff --git a/spec/helpers/user_callouts_helper_spec.rb b/spec/helpers/user_callouts_helper_spec.rb
index 42c2e7827b2..27455705d23 100644
--- a/spec/helpers/user_callouts_helper_spec.rb
+++ b/spec/helpers/user_callouts_helper_spec.rb
@@ -12,44 +12,36 @@ describe UserCalloutsHelper do
subject { helper.show_gke_cluster_integration_callout?(project) }
- context 'when user has not dismissed' do
+ context 'when user can create a cluster' do
before do
- allow(helper).to receive(:user_dismissed?).and_return(false)
+ allow(helper).to receive(:can?).with(anything, :create_cluster, anything)
+ .and_return(true)
end
- context 'when user can create a cluster' do
+ context 'when user has not dismissed' do
before do
- allow(helper).to receive(:can?).with(anything, :create_cluster, anything)
- .and_return(true)
+ allow(helper).to receive(:user_dismissed?).and_return(false)
end
it { is_expected.to be true }
end
- context 'when user can not create a cluster' do
+ context 'when user dismissed' do
before do
- allow(helper).to receive(:can?).with(anything, :create_cluster, anything)
- .and_return(false)
+ allow(helper).to receive(:user_dismissed?).and_return(true)
end
it { is_expected.to be false }
end
end
- context 'when user dismissed' do
+ context 'when user can not create a cluster' do
before do
- allow(helper).to receive(:user_dismissed?).and_return(true)
+ allow(helper).to receive(:can?).with(anything, :create_cluster, anything)
+ .and_return(false)
end
it { is_expected.to be false }
end
-
- context 'when the user is not logged in' do
- before do
- allow(helper).to receive(:current_user).and_return(nil)
- end
-
- it { is_expected.to be_falsey }
- end
end
end