Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiogomez committed Dec 15, 2015
1 parent 977c04a commit a792988
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 153 deletions.
56 changes: 28 additions & 28 deletions spec/features/created_employee_with_projects.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,61 +14,61 @@
end end


scenario 'can visit his dashboard' do scenario 'can visit his dashboard' do
visit '/dashboard' visit '/en/dashboard'


expect(page).to have_text('Daily') expect(page).to have_text('Daily')
expect(page).not_to have_text('No Projects') expect(page).not_to have_text('No Projects')
expect(page).not_to have_text('Please, ask for a project to your boss... ;)') expect(page).not_to have_text('Please, ask for a project to your boss... ;)')
end end


scenario 'can visit his empty day time' do scenario 'can visit his empty day time' do
visit '/time/day' visit '/en/time/day'


expect(page).to have_text(Date.today.strftime('%A %d %b')) expect(page).to have_text(Date.today.strftime('%A %d %b'))
expect(page).to have_text('There is no time entries') expect(page).to have_text('There is no time entries')
expect(page).not_to have_text('Start') expect(page).not_to have_text('Start')
end end


scenario 'can visit his empty week time' do scenario 'can visit his empty week time' do
visit '/time/week' visit '/en/time/week'


expect(page).to have_text('There is no time entries') expect(page).to have_text('There is no time entries')
expect(page).not_to have_selector(:link_or_button, 'Save') expect(page).not_to have_selector(:link_or_button, 'Save')
end end


scenario 'cannot visit the company reports page' do scenario 'cannot visit the company reports page' do
visit '/reports' visit '/en/reports'


expect(page).not_to have_text('Reports') expect(page).not_to have_text('Reports')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the company projects page' do scenario 'cannot visit the company projects page' do
visit '/projects' visit '/en/projects'


expect(page).not_to have_text('Listing projects') expect(page).not_to have_text('Listing projects')
expect(page).not_to have_text(@first_project.name) expect(page).not_to have_text(@first_project.name)
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the company tasks page' do scenario 'cannot visit the company tasks page' do
visit '/tasks' visit '/en/tasks'


expect(page).not_to have_text('Listing tasks') expect(page).not_to have_text('Listing tasks')
expect(page).not_to have_text(@first_task.name) expect(page).not_to have_text(@first_task.name)
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the company clients page' do scenario 'cannot visit the company clients page' do
visit '/clients' visit '/en/clients'


expect(page).not_to have_text('Listing clients') expect(page).not_to have_text('Listing clients')
expect(page).not_to have_text(@first_client.name) expect(page).not_to have_text(@first_client.name)
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the company people page' do scenario 'cannot visit the company people page' do
visit '/people' visit '/en/people'


expect(page).not_to have_text('Listing people') expect(page).not_to have_text('Listing people')
within(:css, ".main") do within(:css, ".main") do
Expand All @@ -79,73 +79,73 @@
end end


scenario 'can visit the new time entry page' do scenario 'can visit the new time entry page' do
visit "/time/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


expect(page).to have_text('Time entry') expect(page).to have_text('Time entry')
expect(page).to have_selector(:link_or_button, 'Start timer') expect(page).to have_selector(:link_or_button, 'Start timer')
end end


scenario 'can visit the add Project/Task Entry page' do scenario 'can visit the add Project/Task Entry page' do
visit "/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


expect(page).to have_text("New Project/Task for week #{Date.today.cweek}") expect(page).to have_text("New Project/Task for week #{Date.today.cweek}")
expect(page).to have_selector(:link_or_button, 'Save') expect(page).to have_selector(:link_or_button, 'Save')
end end


scenario 'cannot visit the new project page' do scenario 'cannot visit the new project page' do
visit "/projects/new" visit "/en/projects/new"


expect(page).not_to have_selector(:link_or_button, 'Create Project') expect(page).not_to have_selector(:link_or_button, 'Create Project')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the edit project page' do scenario 'cannot visit the edit project page' do
visit edit_project_url(@first_project) visit edit_project_path(@first_project, locale: 'en')


expect(page).not_to have_field('Name', @first_project.name) expect(page).not_to have_field('Name', @first_project.name)
expect(page).not_to have_selector(:link_or_button, 'Update Project') expect(page).not_to have_selector(:link_or_button, 'Update Project')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the new task page' do scenario 'cannot visit the new task page' do
visit "/tasks/new" visit "/en/tasks/new"


expect(page).not_to have_selector(:link_or_button, 'Create Task') expect(page).not_to have_selector(:link_or_button, 'Create Task')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the edit task page' do scenario 'cannot visit the edit task page' do
visit edit_task_url(@first_task) visit edit_task_path(@first_task, locale: 'en')


expect(page).not_to have_field('Name', @first_task.name) expect(page).not_to have_field('Name', @first_task.name)
expect(page).not_to have_selector(:link_or_button, 'Update Task') expect(page).not_to have_selector(:link_or_button, 'Update Task')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the new client page' do scenario 'cannot visit the new client page' do
visit "/clients/new" visit "/en/clients/new"


expect(page).not_to have_selector(:link_or_button, 'Create Client') expect(page).not_to have_selector(:link_or_button, 'Create Client')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the edit client page' do scenario 'cannot visit the edit client page' do
visit edit_client_url(@first_client) visit edit_client_path(@first_client, locale: 'en')


expect(page).not_to have_field('Name', @first_client.name) expect(page).not_to have_field('Name', @first_client.name)
expect(page).not_to have_selector(:link_or_button, 'Update Client') expect(page).not_to have_selector(:link_or_button, 'Update Client')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the new person page' do scenario 'cannot visit the new person page' do
visit "/people/new" visit "/en/people/new"


expect(page).not_to have_selector(:link_or_button, 'Create Person') expect(page).not_to have_selector(:link_or_button, 'Create Person')
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'cannot visit the edit person page' do scenario 'cannot visit the edit person page' do
visit edit_person_url(@current_person) visit edit_person_path(@current_person, locale: 'en')


expect(page).not_to have_field('Firstname', @current_person.firstname) expect(page).not_to have_field('Firstname', @current_person.firstname)
expect(page).not_to have_field('Lastname', @current_person.lastname) expect(page).not_to have_field('Lastname', @current_person.lastname)
Expand All @@ -154,23 +154,23 @@
end end


scenario 'can visit his profile page' do scenario 'can visit his profile page' do
visit '/profile' visit '/en/profile'


expect(page).to have_field('Firstname', @current_person.firstname) expect(page).to have_field('Firstname', @current_person.firstname)
expect(page).to have_field('Lastname', @current_person.lastname) expect(page).to have_field('Lastname', @current_person.lastname)
expect(page).to have_selector(:link_or_button, 'Update Person') expect(page).to have_selector(:link_or_button, 'Update Person')
end end


scenario 'cannot visit the company account page' do scenario 'cannot visit the company account page' do
visit '/account' visit '/en/account'


expect(page).not_to have_text('Member since') expect(page).not_to have_text('Member since')
expect(page).not_to have_text(Date.today.strftime('%B %d, %Y')) expect(page).not_to have_text(Date.today.strftime('%B %d, %Y'))
expect(page).to have_text('Daily') expect(page).to have_text('Daily')
end end


scenario 'can create a new time entry for today' do scenario 'can create a new time entry for today' do
visit "/time/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


select(@first_project.name, from: 'Project') select(@first_project.name, from: 'Project')
select(@first_task.name, from: 'Task') select(@first_task.name, from: 'Task')
Expand All @@ -186,7 +186,7 @@
end end


scenario 'can create a new timer for today' do scenario 'can create a new timer for today' do
visit "/time/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


select(@first_project.name, from: 'Project') select(@first_project.name, from: 'Project')
select(@first_task.name, from: 'Task') select(@first_task.name, from: 'Task')
Expand All @@ -200,7 +200,7 @@
end end


scenario 'can create a project/task entry for this week' do scenario 'can create a project/task entry for this week' do
visit "/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


select(@first_project.name, from: 'Project') select(@first_project.name, from: 'Project')
select(@first_task.name, from: 'Task') select(@first_task.name, from: 'Task')
Expand All @@ -212,13 +212,13 @@
end end


scenario 'cannot create a duplicated project/task entry for this week' do scenario 'cannot create a duplicated project/task entry for this week' do
visit "/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


select(@first_project.name, from: 'Project') select(@first_project.name, from: 'Project')
select(@first_task.name, from: 'Task') select(@first_task.name, from: 'Task')
click_button 'Save' click_button 'Save'


visit "/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"
select('Internal', from: 'Project') select('Internal', from: 'Project')


expect(page).not_to have_text(@first_task.name) expect(page).not_to have_text(@first_task.name)
Expand All @@ -227,7 +227,7 @@
scenario 'cannot create more project/task entry for this week when they are all created' do scenario 'cannot create more project/task entry for this week when they are all created' do
@current_person.projects.each do |project| @current_person.projects.each do |project|
project.tasks.each do |task| project.tasks.each do |task|
visit "/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}" visit "/en/time/week/new/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}"


select(project.name, from: 'Project') select(project.name, from: 'Project')
select(task.name, from: 'Task') select(task.name, from: 'Task')
Expand All @@ -247,7 +247,7 @@
end end


scenario 'can edit his profile' do scenario 'can edit his profile' do
visit '/profile' visit '/en/profile'


fill_in 'Firstname', with: 'Renamed' fill_in 'Firstname', with: 'Renamed'


Expand All @@ -258,4 +258,4 @@
expect(page).to have_selector(:link_or_button, 'Update Person') expect(page).to have_selector(:link_or_button, 'Update Person')
end end


end end
Loading

0 comments on commit a792988

Please sign in to comment.