Commit 42d87f90 authored by Matija Čupić's avatar Matija Čupić

Refactor pagination check into separate context

parent ea164796
......@@ -36,14 +36,21 @@ describe Projects::ClustersController do
expect(assigns(:inactive_count)).to eq(project.clusters.disabled.count)
end
it 'properly paginates' do
PAGE_LIMIT = 20
project.clusters = create_list(:cluster, PAGE_LIMIT + 1, :provided_by_gcp, projects: [project])
go
context 'properly paginates' do
before do
PAGE_LIMIT = 20
project.clusters = create_list(:cluster, PAGE_LIMIT + 1, :provided_by_gcp, projects: [project])
end
it 'shows the first page' do
go
expect(assigns(:clusters).count).to eq(PAGE_LIMIT)
end
expect(assigns(:clusters).count).to eq(20)
get :index, namespace_id: project.namespace, project_id: project, page: 2
expect(assigns(:clusters).count).to eq(1)
it 'shows the second page' do
get :index, namespace_id: project.namespace, project_id: project, page: 2
expect(assigns(:clusters).count).to eq(1)
end
end
context 'when only enabled clusters are requested' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment