diff options
Diffstat (limited to 'spec/controllers/import')
-rw-r--r-- | spec/controllers/import/bitbucket_controller_spec.rb | 46 | ||||
-rw-r--r-- | spec/controllers/import/github_controller_spec.rb | 8 | ||||
-rw-r--r-- | spec/controllers/import/gitlab_controller_spec.rb | 46 |
3 files changed, 50 insertions, 50 deletions
diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index 66b45cf33c1..fa4cc0ebbe0 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -31,8 +31,8 @@ describe Import::BitbucketController do expires_at: expires_at, expires_in: expires_in, refresh_token: refresh_token) - allow_any_instance_of(OAuth2::Client) - .to receive(:get_token).and_return(access_token) + allow_any_instance_of(OAuth2::Client). + to receive(:get_token).and_return(access_token) stub_omniauth_provider('bitbucket') get :callback @@ -93,9 +93,9 @@ describe Import::BitbucketController do context "when the repository owner is the Bitbucket user" do context "when the Bitbucket user and GitLab user's usernames match" do it "takes the current user's namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -105,9 +105,9 @@ describe Import::BitbucketController do let(:bitbucket_username) { "someone_else" } it "takes the current user's namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -126,9 +126,9 @@ describe Import::BitbucketController do context "when the namespace is owned by the GitLab user" do it "takes the existing namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, existing_namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).with(bitbucket_repo, bitbucket_repo.name, existing_namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -141,8 +141,8 @@ describe Import::BitbucketController do end it "doesn't create a project" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .not_to receive(:new) + expect(Gitlab::BitbucketImport::ProjectCreator). + not_to receive(:new) post :create, format: :js end @@ -152,16 +152,16 @@ describe Import::BitbucketController do context "when a namespace with the Bitbucket user's username doesn't exist" do context "when current user can create namespaces" do it "creates the namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).and_return(double(execute: true)) expect { post :create, format: :js }.to change(Namespace, :count).by(1) end it "takes the new namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, an_instance_of(Group), user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).with(bitbucket_repo, bitbucket_repo.name, an_instance_of(Group), user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -173,16 +173,16 @@ describe Import::BitbucketController do end it "doesn't create the namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).and_return(double(execute: true)) expect { post :create, format: :js }.not_to change(Namespace, :count) end it "takes the current user's namespace" do - expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::BitbucketImport::ProjectCreator). + to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb index 45c3fa075ef..95696e14b6c 100644 --- a/spec/controllers/import/github_controller_spec.rb +++ b/spec/controllers/import/github_controller_spec.rb @@ -21,10 +21,10 @@ describe Import::GithubController do describe "GET callback" do it "updates access token" do token = "asdasd12345" - allow_any_instance_of(Gitlab::GithubImport::Client) - .to receive(:get_token).and_return(token) - allow_any_instance_of(Gitlab::GithubImport::Client) - .to receive(:github_options).and_return({}) + allow_any_instance_of(Gitlab::GithubImport::Client). + to receive(:get_token).and_return(token) + allow_any_instance_of(Gitlab::GithubImport::Client). + to receive(:github_options).and_return({}) stub_omniauth_provider('github') get :callback diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb index 3ef1bbaa9b7..3f73ea000ae 100644 --- a/spec/controllers/import/gitlab_controller_spec.rb +++ b/spec/controllers/import/gitlab_controller_spec.rb @@ -18,8 +18,8 @@ describe Import::GitlabController do describe "GET callback" do it "updates access token" do - allow_any_instance_of(Gitlab::GitlabImport::Client) - .to receive(:get_token).and_return(token) + allow_any_instance_of(Gitlab::GitlabImport::Client). + to receive(:get_token).and_return(token) stub_omniauth_provider('gitlab') get :callback @@ -78,9 +78,9 @@ describe Import::GitlabController do context "when the repository owner is the GitLab.com user" do context "when the GitLab.com user and GitLab server user's usernames match" do it "takes the current user's namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).with(gitlab_repo, user.namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -90,9 +90,9 @@ describe Import::GitlabController do let(:gitlab_username) { "someone_else" } it "takes the current user's namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).with(gitlab_repo, user.namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -112,9 +112,9 @@ describe Import::GitlabController do context "when the namespace is owned by the GitLab server user" do it "takes the existing namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).with(gitlab_repo, existing_namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).with(gitlab_repo, existing_namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -127,8 +127,8 @@ describe Import::GitlabController do end it "doesn't create a project" do - expect(Gitlab::GitlabImport::ProjectCreator) - .not_to receive(:new) + expect(Gitlab::GitlabImport::ProjectCreator). + not_to receive(:new) post :create, format: :js end @@ -138,16 +138,16 @@ describe Import::GitlabController do context "when a namespace with the GitLab.com user's username doesn't exist" do context "when current user can create namespaces" do it "creates the namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).and_return(double(execute: true)) expect { post :create, format: :js }.to change(Namespace, :count).by(1) end it "takes the new namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).with(gitlab_repo, an_instance_of(Group), user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).with(gitlab_repo, an_instance_of(Group), user, access_params). + and_return(double(execute: true)) post :create, format: :js end @@ -159,16 +159,16 @@ describe Import::GitlabController do end it "doesn't create the namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).and_return(double(execute: true)) expect { post :create, format: :js }.not_to change(Namespace, :count) end it "takes the current user's namespace" do - expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) - .and_return(double(execute: true)) + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).with(gitlab_repo, user.namespace, user, access_params). + and_return(double(execute: true)) post :create, format: :js end |