mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-22 07:04:09 +01:00
fix timing issue in cucumber step and fix regression in adding multiple todos
This commit is contained in:
parent
a3d3537da7
commit
e1c0ff0683
3 changed files with 9 additions and 6 deletions
|
|
@ -180,6 +180,7 @@ class TodosController < ApplicationController
|
||||||
@todos_init = []
|
@todos_init = []
|
||||||
@predecessor = nil
|
@predecessor = nil
|
||||||
validates = true
|
validates = true
|
||||||
|
errors = []
|
||||||
|
|
||||||
# first build all todos and check if they would validate on save
|
# first build all todos and check if they would validate on save
|
||||||
params[:todo][:multiple_todos].split("\n").map do |line|
|
params[:todo][:multiple_todos].split("\n").map do |line|
|
||||||
|
|
@ -188,7 +189,8 @@ class TodosController < ApplicationController
|
||||||
:description => line)
|
:description => line)
|
||||||
@todo.project_id = @project_id
|
@todo.project_id = @project_id
|
||||||
@todo.context_id = @context_id
|
@todo.context_id = @context_id
|
||||||
validates = validates && !@todo.invalid?
|
validates = false if @todo.invalid?
|
||||||
|
|
||||||
@todos_init << @todo
|
@todos_init << @todo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -198,6 +200,7 @@ class TodosController < ApplicationController
|
||||||
if validates
|
if validates
|
||||||
@todos_init.each do |todo|
|
@todos_init.each do |todo|
|
||||||
@saved = todo.save
|
@saved = todo.save
|
||||||
|
validates = validates && @saved
|
||||||
|
|
||||||
if @predecessor && @saved && @sequential
|
if @predecessor && @saved && @sequential
|
||||||
todo.add_predecessor(@predecessor)
|
todo.add_predecessor(@predecessor)
|
||||||
|
|
@ -214,9 +217,10 @@ class TodosController < ApplicationController
|
||||||
@predecessor = todo
|
@predecessor = todo
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@todos = @todos_init
|
||||||
@saved = false
|
@saved = false
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to :action => "index" }
|
format.html { redirect_to :action => "index" }
|
||||||
format.js do
|
format.js do
|
||||||
|
|
@ -229,7 +233,7 @@ class TodosController < ApplicationController
|
||||||
if @saved && @todos.size > 0
|
if @saved && @todos.size > 0
|
||||||
@default_tags = @todos[0].project.default_tags unless @todos[0].project.nil?
|
@default_tags = @todos[0].project.default_tags unless @todos[0].project.nil?
|
||||||
else
|
else
|
||||||
@multiple_error = t('todos.next_action_needed')
|
@multiple_error = @todos.size > 0 ? "" : t('todos.next_action_needed')
|
||||||
@saved = false
|
@saved = false
|
||||||
@default_tags = current_user.projects.find_by_name(@initial_project_name).default_tags unless @initial_project_name.blank?
|
@default_tags = current_user.projects.find_by_name(@initial_project_name).default_tags unless @initial_project_name.blank?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,7 @@ Then /^I should see the note text$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should not see the note "([^"]*)"$/ do |note_content|
|
Then /^I should not see the note "([^"]*)"$/ do |note_content|
|
||||||
if page.has_selector?("div", :text => note_content)
|
page.should_not have_selector("div", :text => note_content, :visible => true)
|
||||||
page.find("div", :text => note_content).should_not be_visible
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see the note "([^"]*)"$/ do |note_content|
|
Then /^I should see the note "([^"]*)"$/ do |note_content|
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ end
|
||||||
When /^I cancel the project edit form$/ do
|
When /^I cancel the project edit form$/ do
|
||||||
click_link "cancel_project_#{@project.id}"
|
click_link "cancel_project_#{@project.id}"
|
||||||
page.should_not have_css("submit_project_#{@project.id}")
|
page.should_not have_css("submit_project_#{@project.id}")
|
||||||
|
wait_for_animations_to_end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I edit the project description to "([^\"]*)"$/ do |new_description|
|
When /^I edit the project description to "([^\"]*)"$/ do |new_description|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue