-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'rails_helper' | ||
|
||
describe 'My Tasks' do | ||
subject { page } | ||
|
||
it 'should require authenticated users' do | ||
project = create(:project) | ||
visit project_tasks_path(project) | ||
expect(current_path).to eq(login_path) | ||
expect(page).to have_content('Access denied.') | ||
end | ||
|
||
context 'as authenticated user' do | ||
before do | ||
login_to_project_as_user | ||
|
||
board = create(:board, project: current_project, node: current_project.methodology_library) | ||
list = create(:list, board: board) | ||
@card = create(:card, list: list) | ||
end | ||
|
||
context 'with assigned tasks' do | ||
it 'renders the user\'s assigned tasks in a dataTable', js: true do | ||
@card.assignees = [User.first] | ||
@card.save | ||
|
||
visit project_tasks_path(current_project) | ||
expect(page).to have_selector('table.dataTable') | ||
expect(page).to have_selector('td a', text: @card.name) | ||
end | ||
end | ||
|
||
context 'without assigned tasks' do | ||
it 'renders an empty state' do | ||
@card.assignees = [] | ||
@card.save | ||
|
||
visit project_tasks_path(current_project) | ||
expect(page).not_to have_selector('table.dataTable') | ||
expect(page).not_to have_selector('td a', text: @card.name) | ||
|
||
expect(page).to have_content("You don't have any assigned tasks yet") | ||
end | ||
end | ||
end | ||
|
||
end |