diff options
Diffstat (limited to 'spec/controllers')
10 files changed, 17 insertions, 0 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index f11b5e798c9..ebdfbe14dec 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' describe Admin::UsersController do let(:user) { create(:user) } + let_it_be(:admin) { create(:admin) } before do diff --git a/spec/controllers/concerns/continue_params_spec.rb b/spec/controllers/concerns/continue_params_spec.rb index b4b62cbe1e3..6af01aa837c 100644 --- a/spec/controllers/concerns/continue_params_spec.rb +++ b/spec/controllers/concerns/continue_params_spec.rb @@ -12,6 +12,7 @@ describe ContinueParams do end end end + subject(:controller) { controller_class.new } def strong_continue_params(params) diff --git a/spec/controllers/concerns/internal_redirect_spec.rb b/spec/controllers/concerns/internal_redirect_spec.rb index e5e50cfd55e..cc6422f2817 100644 --- a/spec/controllers/concerns/internal_redirect_spec.rb +++ b/spec/controllers/concerns/internal_redirect_spec.rb @@ -12,6 +12,7 @@ describe InternalRedirect do end end end + subject(:controller) { controller_class.new } describe '#safe_redirect_path' do diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 4f8ab6a5def..757d8704a6a 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -35,6 +35,7 @@ describe Projects::BranchesController do context "valid branch name, valid source" do let(:branch) { "merge_branch" } let(:ref) { "master" } + it 'redirects' do expect(subject) .to redirect_to("/#{project.full_path}/tree/merge_branch") @@ -44,6 +45,7 @@ describe Projects::BranchesController do context "invalid branch name, valid ref" do let(:branch) { "<script>alert('merge');</script>" } let(:ref) { "master" } + it 'redirects' do expect(subject) .to redirect_to("/#{project.full_path}/tree/alert('merge');") @@ -53,18 +55,21 @@ describe Projects::BranchesController do context "valid branch name, invalid ref" do let(:branch) { "merge_branch" } let(:ref) { "<script>alert('ref');</script>" } + it { is_expected.to render_template('new') } end context "invalid branch name, invalid ref" do let(:branch) { "<script>alert('merge');</script>" } let(:ref) { "<script>alert('ref');</script>" } + it { is_expected.to render_template('new') } end context "valid branch name with encoded slashes" do let(:branch) { "feature%2Ftest" } let(:ref) { "<script>alert('ref');</script>" } + it { is_expected.to render_template('new') } it { project.repository.branch_exists?('feature/test') } end diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index ab8bfc0cabe..642932e2935 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -26,6 +26,7 @@ describe Projects::ClustersController do let(:project) { create(:project) } let!(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let!(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) } + it 'lists available clusters' do go diff --git a/spec/controllers/projects/find_file_controller_spec.rb b/spec/controllers/projects/find_file_controller_spec.rb index a493985f8a0..4d8933f3aaf 100644 --- a/spec/controllers/projects/find_file_controller_spec.rb +++ b/spec/controllers/projects/find_file_controller_spec.rb @@ -28,11 +28,13 @@ describe Projects::FindFileController do context "valid branch" do let(:id) { 'master' } + it { is_expected.to respond_with(:success) } end context "invalid branch" do let(:id) { 'invalid-branch' } + it { is_expected.to respond_with(:not_found) } end end @@ -50,6 +52,7 @@ describe Projects::FindFileController do context "valid branch" do let(:id) { 'master' } + it 'returns an array of file path list' do go diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index f64e928098d..945a56365c8 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -1357,6 +1357,7 @@ describe Projects::IssuesController do describe 'GET #discussions' do let!(:discussion) { create(:discussion_note_on_issue, noteable: issue, project: issue.project) } + context 'when authenticated' do before do project.add_developer(user) diff --git a/spec/controllers/projects/tags_controller_spec.rb b/spec/controllers/projects/tags_controller_spec.rb index 7e5237facf6..15ef1c65c53 100644 --- a/spec/controllers/projects/tags_controller_spec.rb +++ b/spec/controllers/projects/tags_controller_spec.rb @@ -29,11 +29,13 @@ describe Projects::TagsController do context "valid tag" do let(:id) { 'v1.0.0' } + it { is_expected.to respond_with(:success) } end context "invalid tag" do let(:id) { 'latest' } + it { is_expected.to respond_with(:not_found) } end end diff --git a/spec/controllers/projects/wikis_controller_spec.rb b/spec/controllers/projects/wikis_controller_spec.rb index 3100aa2cb96..bfa555aab4c 100644 --- a/spec/controllers/projects/wikis_controller_spec.rb +++ b/spec/controllers/projects/wikis_controller_spec.rb @@ -213,6 +213,7 @@ describe Projects::WikisController do describe 'PATCH #update' do let(:new_title) { 'New title' } let(:new_content) { 'New content' } + subject do patch(:update, params: { diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index bbbb9691f53..597d2a185b5 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -81,6 +81,7 @@ describe UsersController do context 'json with events' do let(:project) { create(:project) } + before do project.add_developer(user) Gitlab::DataBuilder::Push.build_sample(project, user) |