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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-08 18:21:08 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-08 18:21:08 +0300
commit9560639e817147064e3929243668e49336a4f3f5 (patch)
treed2c60fafbd6b79686ef29604bd8e2826707821a7 /spec/support/import_spec_helper.rb
parent13d941e185c3ca1e9ad54c97f878e9cfdd32e5aa (diff)
Move ImportSpecHelper to spec/support/
Diffstat (limited to 'spec/support/import_spec_helper.rb')
-rw-r--r--spec/support/import_spec_helper.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/support/import_spec_helper.rb b/spec/support/import_spec_helper.rb
new file mode 100644
index 00000000000..6710962f082
--- /dev/null
+++ b/spec/support/import_spec_helper.rb
@@ -0,0 +1,33 @@
+require 'ostruct'
+
+# Helper methods for controller specs in the Import namespace
+#
+# Must be included manually.
+module ImportSpecHelper
+ # Stub `controller` to return a null object double with the provided messages
+ # when `client` is called
+ #
+ # Examples:
+ #
+ # stub_client(foo: %w(foo))
+ #
+ # controller.client.foo # => ["foo"]
+ # controller.client.bar.baz.foo # => ["foo"]
+ #
+ # Returns the client double
+ def stub_client(messages = {})
+ client = double('client', messages).as_null_object
+ allow(controller).to receive(:client).and_return(client)
+
+ client
+ end
+
+ def stub_omniauth_provider(name)
+ provider = OpenStruct.new(
+ name: name,
+ app_id: 'asd123',
+ app_secret: 'asd123'
+ )
+ allow(Gitlab.config.omniauth).to receive(:providers).and_return([provider])
+ end
+end