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:
Diffstat (limited to 'qa/spec/resource/user_spec.rb')
-rw-r--r--qa/spec/resource/user_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/qa/spec/resource/user_spec.rb b/qa/spec/resource/user_spec.rb
index d82dcc3b21e..d1fc02ff033 100644
--- a/qa/spec/resource/user_spec.rb
+++ b/qa/spec/resource/user_spec.rb
@@ -116,4 +116,31 @@ RSpec.describe QA::Resource::User do
expect(subject).to be_credentials_given
end
end
+
+ describe '#has_user?' do
+ let(:index_mock) do
+ instance_double(QA::Page::Admin::Overview::Users::Index)
+ end
+
+ users = [
+ ['foo', true],
+ ['bar', false]
+ ]
+
+ users.each do |(username, found)|
+ it "returns #{found} when has_username returns #{found}" do
+ subject.username = username
+
+ allow(QA::Flow::Login).to receive(:while_signed_in_as_admin).and_yield
+ allow(QA::Page::Main::Menu).to receive(:perform)
+ allow(QA::Page::Admin::Menu).to receive(:perform)
+ allow(QA::Page::Admin::Overview::Users::Index).to receive(:perform).and_yield(index_mock)
+
+ expect(index_mock).to receive(:search_user).with(username)
+ expect(index_mock).to receive(:has_username?).with(username).and_return(found)
+
+ expect(subject.has_user?(subject)).to eq(found)
+ end
+ end
+ end
end