Permalink
Browse files

Fixing tests

  • Loading branch information...
sergiogomez committed Dec 15, 2015
1 parent 977c04a commit a792988e39514e0ab64cb03e41f39c8047823517
@@ -14,61 +14,61 @@
end
scenario 'can visit his dashboard' do
visit '/dashboard'
visit '/en/dashboard'
expect(page).to have_text('Daily')
expect(page).not_to have_text('No Projects')
expect(page).not_to have_text('Please, ask for a project to your boss... ;)')
end
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('There is no time entries')
expect(page).not_to have_text('Start')
end
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).not_to have_selector(:link_or_button, 'Save')
end
scenario 'cannot visit the company reports page' do
visit '/reports'
visit '/en/reports'
expect(page).not_to have_text('Reports')
expect(page).to have_text('Daily')
end
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(@first_project.name)
expect(page).to have_text('Daily')
end
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(@first_task.name)
expect(page).to have_text('Daily')
end
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(@first_client.name)
expect(page).to have_text('Daily')
end
scenario 'cannot visit the company people page' do
visit '/people'
visit '/en/people'
expect(page).not_to have_text('Listing people')
within(:css, ".main") do
@@ -79,73 +79,73 @@
end
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_selector(:link_or_button, 'Start timer')
end
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_selector(:link_or_button, 'Save')
end
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).to have_text('Daily')
end
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_selector(:link_or_button, 'Update Project')
expect(page).to have_text('Daily')
end
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).to have_text('Daily')
end
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_selector(:link_or_button, 'Update Task')
expect(page).to have_text('Daily')
end
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).to have_text('Daily')
end
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_selector(:link_or_button, 'Update Client')
expect(page).to have_text('Daily')
end
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).to have_text('Daily')
end
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('Lastname', @current_person.lastname)
@@ -154,23 +154,23 @@
end
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('Lastname', @current_person.lastname)
expect(page).to have_selector(:link_or_button, 'Update Person')
end
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(Date.today.strftime('%B %d, %Y'))
expect(page).to have_text('Daily')
end
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_task.name, from: 'Task')
@@ -186,7 +186,7 @@
end
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_task.name, from: 'Task')
@@ -200,7 +200,7 @@
end
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_task.name, from: 'Task')
@@ -212,13 +212,13 @@
end
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_task.name, from: 'Task')
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')
expect(page).not_to have_text(@first_task.name)
@@ -227,7 +227,7 @@
scenario 'cannot create more project/task entry for this week when they are all created' do
@current_person.projects.each do |project|
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(task.name, from: 'Task')
@@ -247,7 +247,7 @@
end
scenario 'can edit his profile' do
visit '/profile'
visit '/en/profile'
fill_in 'Firstname', with: 'Renamed'
@@ -258,4 +258,4 @@
expect(page).to have_selector(:link_or_button, 'Update Person')
end
end
end
Oops, something went wrong.

0 comments on commit a792988

Please sign in to comment.