diff options
author | Matija Čupić <matteeyah@gmail.com> | 2017-12-01 00:23:10 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2017-12-11 17:06:45 +0300 |
commit | 4882c793019f4c46ca20e0c187dc97e10cf5a3ce (patch) | |
tree | c8f965ebda2b28aff5f9b39b1cd31af72a4a789f | |
parent | 8ff63039f1ee5f6e31a8b910e323977e7de3c634 (diff) |
Remove cluster scope from ClustersController#index
-rw-r--r-- | app/controllers/projects/clusters_controller.rb | 7 | ||||
-rw-r--r-- | spec/controllers/projects/clusters_controller_spec.rb | 28 |
2 files changed, 2 insertions, 33 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 0907daacbc3..4a7879db313 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -8,11 +8,8 @@ class Projects::ClustersController < Projects::ApplicationController STATUS_POLLING_INTERVAL = 10_000 def index - @scope = params[:scope] || 'all' - @clusters = ClustersFinder.new(project, current_user, @scope).execute.page(params[:page]) - @active_count = ClustersFinder.new(project, current_user, :active).execute.count - @inactive_count = ClustersFinder.new(project, current_user, :inactive).execute.count - @all_count = @active_count + @inactive_count + clusters = ClustersFinder.new(project, current_user, :all).execute + @clusters = clusters.page(params[:page]).per(20) end def new diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index 280b7e4d8b9..a3b13647c92 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -27,13 +27,6 @@ describe Projects::ClustersController do expect(assigns(:clusters)).to match_array([enabled_cluster, disabled_cluster]) end - it 'assigns counters to correct values' do - go - - expect(assigns(:active_count)).to eq(1) - expect(assigns(:inactive_count)).to eq(1) - end - context 'when page is specified' do let(:last_page) { project.clusters.page.total_pages } @@ -48,20 +41,6 @@ describe Projects::ClustersController do expect(assigns(:clusters).current_page).to eq(last_page) end end - - context 'when only enabled clusters are requested' do - it 'returns only enabled clusters' do - get :index, namespace_id: project.namespace, project_id: project, scope: 'active' - expect(assigns(:clusters)).to all(have_attributes(enabled: true)) - end - end - - context 'when only disabled clusters are requested' do - it 'returns only disabled clusters' do - get :index, namespace_id: project.namespace, project_id: project, scope: 'inactive' - expect(assigns(:clusters)).to all(have_attributes(enabled: false)) - end - end end context 'when project does not have a cluster' do @@ -74,13 +53,6 @@ describe Projects::ClustersController do expect(response).to render_template(:index, partial: :empty_state) expect(assigns(:clusters)).to eq([]) end - - it 'assigns counters to zero' do - go - - expect(assigns(:active_count)).to eq(0) - expect(assigns(:inactive_count)).to eq(0) - end end end |