mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-28 01:36:33 +08:00
Fix context block for ProjectsOverviewService#projects_datatable test with { filter: 'archived' } parameter
This commit is contained in:
parent
4bf1d904b7
commit
1be952fdbb
1 changed files with 90 additions and 90 deletions
|
@ -336,12 +336,55 @@ describe ProjectsOverviewService do
|
||||||
expect(projects2.length).to eq 12
|
expect(projects2.length).to eq 12
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with request parameters { filter: 'archived' }" do
|
context "with request parameters { filter: 'archived' }" do
|
||||||
let(:params) { super().merge(filter: 'archived') }
|
let(:params) { super().merge(filter: 'archived') }
|
||||||
|
|
||||||
|
it 'returns archived projects, sorted by ascending archivation ' \
|
||||||
|
'attribute (active first), offset by 0, paginated by 10' do
|
||||||
|
projects = projects_overview.projects_datatable(params)
|
||||||
|
expect(projects.length).to eq 10
|
||||||
|
expect(projects.uniq.length).to eq projects.length
|
||||||
|
expect(projects).not_to include(project_1, project_3, project_6)
|
||||||
|
projects1 = projects.select(&:archived?)
|
||||||
|
expect(projects1.length).to eq 10
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with request parameters { start: 15 }' do
|
||||||
|
let(:params) { super().merge(start: 15) }
|
||||||
|
|
||||||
it 'returns archived projects, sorted by ascending archivation ' \
|
it 'returns archived projects, sorted by ascending archivation ' \
|
||||||
'attribute (active first), offset by 0, paginated by 10' do
|
'attribute (active first), offset by 15, paginated by 10' do
|
||||||
|
projects = projects_overview.projects_datatable(params)
|
||||||
|
expect(projects.length).to eq 3
|
||||||
|
expect(projects.uniq.length).to eq projects.length
|
||||||
|
expect(projects).not_to include(project_1, project_2, project_3,
|
||||||
|
project_4, project_5, project_6)
|
||||||
|
projects1 = projects.select(&:archived?)
|
||||||
|
expect(projects1.length).to eq 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with request parameters { length: 5 }' do
|
||||||
|
let(:params) { super().merge(length: 5) }
|
||||||
|
|
||||||
|
it 'returns archived projects, sorted by ascending archivation ' \
|
||||||
|
'attribute (active first), offset by 0, paginated by 5' do
|
||||||
|
projects = projects_overview.projects_datatable(params)
|
||||||
|
expect(projects.length).to eq 5
|
||||||
|
expect(projects.uniq.length).to eq projects.length
|
||||||
|
expect(projects).not_to include(project_1, project_3, project_6)
|
||||||
|
projects1 = projects.select(&:archived?)
|
||||||
|
expect(projects1.length).to eq 5
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with request parameters { order: { '0': { dir: 'ASC' } } }" do
|
||||||
|
let(:params) { super().merge(order: { '0': { dir: 'ASC' } }) }
|
||||||
|
|
||||||
|
it 'returns archived projects, sorted by ascending archivation ' \
|
||||||
|
'attribute (archived first), offset by 0, paginated by 10' do
|
||||||
projects = projects_overview.projects_datatable(params)
|
projects = projects_overview.projects_datatable(params)
|
||||||
expect(projects.length).to eq 10
|
expect(projects.length).to eq 10
|
||||||
expect(projects.uniq.length).to eq projects.length
|
expect(projects.uniq.length).to eq projects.length
|
||||||
|
@ -349,97 +392,54 @@ describe ProjectsOverviewService do
|
||||||
projects1 = projects.select(&:archived?)
|
projects1 = projects.select(&:archived?)
|
||||||
expect(projects1.length).to eq 10
|
expect(projects1.length).to eq 10
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'with request parameters { start: 15 }' do
|
context "with request parameters { order: { '0': { dir: 'DESC' } } }" do
|
||||||
let(:params) { super().merge(start: 15) }
|
let(:params) { super().merge(order: { '0': { dir: 'DESC' } }) }
|
||||||
|
|
||||||
it 'returns archived projects, sorted by ascending archivation ' \
|
it 'returns archived projects, sorted by descending ' \
|
||||||
'attribute (active first), offset by 15, paginated by 10' do
|
'archivation attribute (archived first), offset by 0, ' \
|
||||||
projects = projects_overview.projects_datatable(params)
|
'paginated by 10' do
|
||||||
expect(projects.length).to eq 3
|
projects = projects_overview.projects_datatable(params)
|
||||||
expect(projects.uniq.length).to eq projects.length
|
expect(projects.length).to eq 10
|
||||||
expect(projects).not_to include(project_1, project_2, project_3,
|
expect(projects.uniq.length).to eq projects.length
|
||||||
project_4, project_5, project_6)
|
expect(projects).not_to include(project_1, project_3, project_6)
|
||||||
projects1 = projects.select(&:archived?)
|
projects1 = projects.select(&:archived?)
|
||||||
expect(projects1.length).to eq 3
|
expect(projects1.length).to eq 10
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with request parameters { start: 13, length: 4 }' do
|
||||||
|
let(:params) { super().merge(start: 13, length: 4) }
|
||||||
|
|
||||||
|
it 'returns archived projects, sorted by ascending archivation ' \
|
||||||
|
'attribute (active first), offset by 13, paginated by 4' do
|
||||||
|
projects = projects_overview.projects_datatable(params)
|
||||||
|
expect(projects.length).to eq 1
|
||||||
|
expect(projects).not_to include(project_1, project_2, project_3,
|
||||||
|
project_4, project_5, project_6)
|
||||||
|
projects1 = projects.select(&:archived?)
|
||||||
|
expect(projects1.length).to eq 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with request parameters { start: 7, length: 6, " \
|
||||||
|
"order: { '0': { dir: 'DESC', column: '3' } } }" do
|
||||||
|
let(:params) do
|
||||||
|
super().merge(start: 7, length: 6,
|
||||||
|
order: { '0': { dir: 'DESC', column: '3' } })
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with request parameters { length: 5 }' do
|
it 'returns archived projects, sorted by descending creation ' \
|
||||||
let(:params) { super().merge(length: 5) }
|
'time attribute (active first), offset by 7, paginated by ' \
|
||||||
|
'6' do
|
||||||
it 'returns archived projects, sorted by ascending archivation ' \
|
projects = projects_overview.projects_datatable(params)
|
||||||
'attribute (active first), offset by 0, paginated by 5' do
|
expect(projects.length).to eq 6
|
||||||
projects = projects_overview.projects_datatable(params)
|
expect(projects.uniq.length).to eq projects.length
|
||||||
expect(projects.length).to eq 5
|
expect(projects.last(2)).to eq [project_5, project_4]
|
||||||
expect(projects.uniq.length).to eq projects.length
|
expect(projects).not_to include(project_1, project_3, project_6)
|
||||||
expect(projects).not_to include(project_1, project_3, project_6)
|
projects1 = projects.select(&:archived?)
|
||||||
projects1 = projects.select(&:archived?)
|
expect(projects1.length).to eq 6
|
||||||
expect(projects1.length).to eq 5
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with request parameters { order: { '0': { dir: 'ASC' } } }" do
|
|
||||||
let(:params) { super().merge(order: { '0': { dir: 'ASC' } }) }
|
|
||||||
|
|
||||||
it 'returns archived projects, sorted by ascending archivation ' \
|
|
||||||
'attribute (archived first), offset by 0, paginated by 10' do
|
|
||||||
projects = projects_overview.projects_datatable(params)
|
|
||||||
expect(projects.length).to eq 10
|
|
||||||
expect(projects.uniq.length).to eq projects.length
|
|
||||||
expect(projects).not_to include(project_1, project_3, project_6)
|
|
||||||
projects1 = projects.select(&:archived?)
|
|
||||||
expect(projects1.length).to eq 10
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with request parameters { order: { '0': { dir: 'DESC' } } }" do
|
|
||||||
let(:params) { super().merge(order: { '0': { dir: 'DESC' } }) }
|
|
||||||
|
|
||||||
it 'returns archived projects, sorted by descending ' \
|
|
||||||
'archivation attribute (archived first), offset by 0, ' \
|
|
||||||
'paginated by 10' do
|
|
||||||
projects = projects_overview.projects_datatable(params)
|
|
||||||
expect(projects.length).to eq 10
|
|
||||||
expect(projects.uniq.length).to eq projects.length
|
|
||||||
expect(projects).not_to include(project_1, project_3, project_6)
|
|
||||||
projects1 = projects.select(&:archived?)
|
|
||||||
expect(projects1.length).to eq 10
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with request parameters { start: 13, length: 4 }' do
|
|
||||||
let(:params) { super().merge(start: 13, length: 4) }
|
|
||||||
|
|
||||||
it 'returns archived projects, sorted by ascending archivation ' \
|
|
||||||
'attribute (active first), offset by 13, paginated by 4' do
|
|
||||||
projects = projects_overview.projects_datatable(params)
|
|
||||||
expect(projects.length).to eq 1
|
|
||||||
expect(projects).not_to include(project_1, project_2, project_3,
|
|
||||||
project_4, project_5, project_6)
|
|
||||||
projects1 = projects.select(&:archived?)
|
|
||||||
expect(projects1.length).to eq 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with request parameters { start: 7, length: 6, " \
|
|
||||||
"order: { '0': { dir: 'DESC', column: '3' } } }" do
|
|
||||||
let(:params) do
|
|
||||||
super().merge(start: 7, length: 6,
|
|
||||||
order: { '0': { dir: 'DESC', column: '3' } })
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns archived projects, sorted by descending creation ' \
|
|
||||||
'time attribute (active first), offset by 7, paginated by ' \
|
|
||||||
'6' do
|
|
||||||
projects = projects_overview.projects_datatable(params)
|
|
||||||
expect(projects.length).to eq 6
|
|
||||||
expect(projects.uniq.length).to eq projects.length
|
|
||||||
expect(projects.last(2)).to eq [project_5, project_4]
|
|
||||||
expect(projects).not_to include(project_1, project_3, project_6)
|
|
||||||
projects1 = projects.select(&:archived?)
|
|
||||||
expect(projects1.length).to eq 6
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue