diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-04-23 12:27:09 +0200 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-04-23 12:27:09 +0200 |
commit | 952e2dc6d9cfacf223345bd34dacb0d34d3fdeca (patch) | |
tree | 9e1db5aedd40687d61ad837448794b9d7a611e0a /spec/features/todos/todos_spec.rb | |
parent | 7910853368970292eb243ee34072c7f527fa67f2 (diff) | |
parent | 7acea6bde9dbffafc99401eb0d7bb748c1f06d3f (diff) | |
download | gitlab-ce-952e2dc6d9cfacf223345bd34dacb0d34d3fdeca.tar.gz |
Merge branch 'master' into eReGeBe/gitlab-ce-feature/milestone-md
Diffstat (limited to 'spec/features/todos/todos_spec.rb')
-rw-r--r-- | spec/features/todos/todos_spec.rb | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb index 113d4c40cfc..248e004ba6e 100644 --- a/spec/features/todos/todos_spec.rb +++ b/spec/features/todos/todos_spec.rb @@ -1,12 +1,10 @@ require 'spec_helper' describe 'Dashboard Todos', feature: true do - let(:user){ create(:user) } - let(:author){ create(:user) } - let(:project){ create(:project) } - let(:issue){ create(:issue) } - let(:todos_per_page){ Todo.default_per_page } - let(:todos_total){ todos_per_page + 1 } + let(:user) { create(:user) } + let(:author) { create(:user) } + let(:project) { create(:project) } + let(:issue) { create(:issue) } describe 'GET /dashboard/todos' do context 'User does not have todos' do @@ -46,31 +44,35 @@ describe 'Dashboard Todos', feature: true do end context 'User has multiple pages of Todos' do - let(:todo_total_pages){ (todos_total.to_f/todos_per_page).ceil } - before do - todos_total.times do - create(:todo, :mentioned, user: user, project: project, target: issue, author: author) - end + allow(Todo).to receive(:default_per_page).and_return(1) + + # Create just enough records to cause us to paginate + create_list(:todo, 2, :mentioned, user: user, project: project, target: issue, author: author) login_as(user) - visit dashboard_todos_path end it 'is paginated' do + visit dashboard_todos_path + expect(page).to have_selector('.gl-pagination') end it 'is has the right number of pages' do - expect(page).to have_selector('.gl-pagination .page', count: todo_total_pages) + visit dashboard_todos_path + + expect(page).to have_selector('.gl-pagination .page', count: 2) end - describe 'deleting last todo from last page', js: true do + describe 'completing last todo from last page', js: true do it 'redirects to the previous page' do - page.within('.gl-pagination') do - click_link todo_total_pages.to_s - end - first('.done-todo').click + visit dashboard_todos_path(page: 2) + expect(page).to have_content(Todo.first.body) + + click_link('Done') + + expect(current_path).to eq dashboard_todos_path expect(page).to have_content(Todo.last.body) end end |