mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
fix some failing cucumber tests
This commit is contained in:
parent
def136374c
commit
3b673f0838
12 changed files with 41 additions and 33 deletions
|
|
@ -55,7 +55,7 @@ GEM
|
||||||
cache_digests (0.3.1)
|
cache_digests (0.3.1)
|
||||||
actionpack (>= 3.2)
|
actionpack (>= 3.2)
|
||||||
thread_safe
|
thread_safe
|
||||||
capybara (2.2.0)
|
capybara (2.2.1)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
|
|
@ -122,7 +122,7 @@ GEM
|
||||||
protected_attributes (1.0.5)
|
protected_attributes (1.0.5)
|
||||||
activemodel (>= 4.0.1, < 5.0)
|
activemodel (>= 4.0.1, < 5.0)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
rack-mini-profiler (0.1.31)
|
rack-mini-profiler (0.9.0)
|
||||||
rack (>= 1.1.3)
|
rack (>= 1.1.3)
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def all_done_todos_for(object)
|
def all_done_todos_for(object)
|
||||||
object_name = object.class.name.downcase # context or project
|
object_name = object.class.name.downcase # context or project
|
||||||
@source_view = object_name
|
@source_view = "all_done"
|
||||||
@page_title = t("#{object_name.pluralize}.all_completed_tasks_title", "#{object_name}_name".to_sym => object.name)
|
@page_title = t("#{object_name.pluralize}.all_completed_tasks_title", "#{object_name}_name".to_sym => object.name)
|
||||||
|
|
||||||
@done = object.todos.completed.reorder('completed_at DESC').includes(Todo::DEFAULT_INCLUDES).
|
@done = object.todos.completed.reorder('completed_at DESC').includes(Todo::DEFAULT_INCLUDES).
|
||||||
|
|
@ -280,11 +280,11 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def done_todos_for(object)
|
def done_todos_for(object)
|
||||||
object_name = object.class.name.downcase # context or project
|
object_name = object.class.name.downcase # context or project
|
||||||
@source_view = object_name
|
@source_view = "done"
|
||||||
eval("@#{object_name} = object")
|
eval("@#{object_name} = object")
|
||||||
@page_title = t("#{object_name.pluralize}.completed_tasks_title", "#{object_name}_name".to_sym => object.name)
|
@page_title = t("#{object_name.pluralize}.completed_tasks_title", "#{object_name}_name".to_sym => object.name)
|
||||||
|
|
||||||
@done_today, @done_rest_of_week, @done_rest_of_month = DoneTodos.done_todos_for_container(object)
|
@done_today, @done_rest_of_week, @done_rest_of_month = DoneTodos.done_todos_for_container(object.todos)
|
||||||
@count = @done_today.size + @done_rest_of_week.size + @done_rest_of_month.size
|
@count = @done_today.size + @done_rest_of_week.size + @done_rest_of_month.size
|
||||||
|
|
||||||
render :template => 'todos/done'
|
render :template => 'todos/done'
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ class TodosController < ApplicationController
|
||||||
@source_view = 'done'
|
@source_view = 'done'
|
||||||
@page_title = t('todos.completed_tasks_title')
|
@page_title = t('todos.completed_tasks_title')
|
||||||
|
|
||||||
@done_today, @done_rest_of_week, @done_rest_of_month = DoneTodos.done_todos_for_container(current_user)
|
@done_today, @done_rest_of_week, @done_rest_of_month = DoneTodos.done_todos_for_container(current_user.todos)
|
||||||
@count = @done_today.size + @done_rest_of_week.size + @done_rest_of_month.size
|
@count = @done_today.size + @done_rest_of_week.size + @done_rest_of_month.size
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
@ -672,7 +672,7 @@ class TodosController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def done_by_tag_setup
|
def done_by_tag_setup
|
||||||
@source_view = params['_source_view'] || 'tag'
|
@source_view = params['_source_view'] || 'done'
|
||||||
@tag_name = sanitize(params[:name]) # sanitize to prevent XSS vunerability!
|
@tag_name = sanitize(params[:name]) # sanitize to prevent XSS vunerability!
|
||||||
@page_title = t('todos.all_completed_tagged_page_title', :tag_name => @tag_name)
|
@page_title = t('todos.all_completed_tagged_page_title', :tag_name => @tag_name)
|
||||||
@tag = Tag.where(:name => @tag_name).first_or_create
|
@tag = Tag.where(:name => @tag_name).first_or_create
|
||||||
|
|
@ -762,7 +762,7 @@ class TodosController < ApplicationController
|
||||||
@items = get_not_completed_for_predecessor(current_user, @todo.id) unless !@items.empty?
|
@items = get_not_completed_for_predecessor(current_user, @todo.id) unless !@items.empty?
|
||||||
else
|
else
|
||||||
# New todo - TODO: Filter on current project in project view
|
# New todo - TODO: Filter on current project in project view
|
||||||
@items = get_not_complete_for_predecessor(current_user)
|
@items = get_not_completed_for_predecessor(current_user)
|
||||||
end
|
end
|
||||||
render :inline => format_dependencies_as_json_for_auto_complete(@items)
|
render :inline => format_dependencies_as_json_for_auto_complete(@items)
|
||||||
end
|
end
|
||||||
|
|
@ -1003,7 +1003,10 @@ end
|
||||||
@target_context_count = actions_in_target.count
|
@target_context_count = actions_in_target.count
|
||||||
}
|
}
|
||||||
from.done {
|
from.done {
|
||||||
@remaining_in_context = DoneTodos.remaining_in_container(current_user, @original_completed_period)
|
@remaining_in_context = DoneTodos.remaining_in_container(current_user.todos, @original_completed_period)
|
||||||
|
}
|
||||||
|
from.all_done {
|
||||||
|
@remaining_in_context = current_user.todos.completed.count
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -523,7 +523,7 @@ module TodosHelper
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
return false if source_view_is_one_of(:calendar, :done)
|
return false if source_view_is_one_of(:calendar, :done, :all_done)
|
||||||
|
|
||||||
return @remaining_in_context == 0
|
return @remaining_in_context == 0
|
||||||
end
|
end
|
||||||
|
|
@ -692,6 +692,7 @@ module TodosHelper
|
||||||
}
|
}
|
||||||
page.todo { container_id = context_container_empty_id(@original_item) if @remaining_in_context == 0 }
|
page.todo { container_id = context_container_empty_id(@original_item) if @remaining_in_context == 0 }
|
||||||
page.done { container_id = "completed_#{@original_completed_period}_container-empty-d" if @remaining_in_context == 0 }
|
page.done { container_id = "completed_#{@original_completed_period}_container-empty-d" if @remaining_in_context == 0 }
|
||||||
|
page.all_done { container_id = "all-done-empty-nd" if @remaining_in_context == 0 }
|
||||||
end
|
end
|
||||||
return container_id.blank? ? "" : "$(\"##{container_id}\").slideDown(100);".html_safe
|
return container_id.blank? ? "" : "$(\"##{container_id}\").slideDown(100);".html_safe
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,11 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="paginate_header"><%= will_paginate @done, paginate_options %></div>
|
<div class="paginate_header"><%= will_paginate @done, paginate_options %></div>
|
||||||
<h2><%= t('todos.all_completed') %></h2>
|
<h2><%= t('todos.all_completed') %></h2>
|
||||||
<% if @done.empty? -%>
|
<div id="all-done-empty-nd" style="<%= @done.empty? ? 'display:block' : 'display:none'%>">
|
||||||
<div class="message"><p><%= t('todos.no_completed_actions') %></p></div>
|
<div class="message"><p><%= t('todos.no_completed_actions') %></p></div>
|
||||||
<% else -%>
|
</div>
|
||||||
|
|
||||||
|
<% if !@done.empty? -%>
|
||||||
<%= render :partial => "todos/todo", :collection => @done, :locals => { :parent_container_type => "completed", :suppress_context => false, :suppress_project => false } %>
|
<%= render :partial => "todos/todo", :collection => @done, :locals => { :parent_container_type => "completed", :suppress_context => false, :suppress_project => false } %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ Feature: Show all due actions in a calendar view
|
||||||
When I clear the due date of "something new"
|
When I clear the due date of "something new"
|
||||||
Then I should not see the todo "something new"
|
Then I should not see the todo "something new"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Deleting a todo will remove it from the calendar
|
Scenario: Deleting a todo will remove it from the calendar
|
||||||
Given I have a todo "something new" in the context "@calendar" which is due tomorrow
|
Given I have a todo "something new" in the context "@calendar" which is due tomorrow
|
||||||
When I go to the calendar page
|
When I go to the calendar page
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ Feature: Edit a next action from every page
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario Outline: Changing container of the todo in that container will hide it
|
Scenario Outline: Changing container of the todo in that container will hide it
|
||||||
# this script fails on https://code.google.com/p/selenium/issues/detail?id=3075 for selenium-webdriver > 2.14.
|
|
||||||
# and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This may work with webkit though
|
|
||||||
Given I have a todo "delete me" in the context "@home" in the project "do it"
|
Given I have a todo "delete me" in the context "@home" in the project "do it"
|
||||||
And I have a project "go for it"
|
And I have a project "go for it"
|
||||||
And I have selected the view for group by <grouping>
|
And I have selected the view for group by <grouping>
|
||||||
|
|
@ -249,8 +247,6 @@ Feature: Edit a next action from every page
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: I can defer a todo
|
Scenario: I can defer a todo
|
||||||
# this script fails on https://code.google.com/p/selenium/issues/detail?id=3075 for selenium-webdriver > 2.14.
|
|
||||||
# and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This will work on webkit though
|
|
||||||
When I go to the home page
|
When I go to the home page
|
||||||
And I submit a new action with description "start later" in the context "@pc"
|
And I submit a new action with description "start later" in the context "@pc"
|
||||||
And I defer "start later" for 1 day
|
And I defer "start later" for 1 day
|
||||||
|
|
@ -260,8 +256,6 @@ Feature: Edit a next action from every page
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: I can make a project from a todo
|
Scenario: I can make a project from a todo
|
||||||
# this script fails on https://code.google.com/p/selenium/issues/detail?id=3075 for selenium-webdriver > 2.14.
|
|
||||||
# and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This will work on webkit though
|
|
||||||
When I go to the home page
|
When I go to the home page
|
||||||
And I submit a new action with description "buy mediacenter" in the context "@pc"
|
And I submit a new action with description "buy mediacenter" in the context "@pc"
|
||||||
And I make a project of "buy mediacenter"
|
And I make a project of "buy mediacenter"
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,14 @@ Then /^I should not see a project named "([^"]*)"$/ do |project_name|
|
||||||
step "I should see that a project named \"#{project_name}\" is not present"
|
step "I should see that a project named \"#{project_name}\" is not present"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then(/^I should not see the project "(.*?)"$/) do |project_name|
|
||||||
|
project = @current_user.projects.where(:name => project_name).first
|
||||||
|
project.should_not be_nil
|
||||||
|
|
||||||
|
project_xpath = "//div[@id='project_#{project.id}']"
|
||||||
|
page.should_not have_xpath(project_xpath)
|
||||||
|
end
|
||||||
|
|
||||||
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
|
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
|
||||||
project_list_find_index(project_high).should < project_list_find_index(project_low)
|
project_list_find_index(project_high).should < project_list_find_index(project_low)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
|
||||||
get_confirm_text.should == "Are you sure that you want to delete the action '#{todo.description}'?"
|
get_confirm_text.should == "Are you sure that you want to delete the action '#{todo.description}'?"
|
||||||
|
|
||||||
wait_for_ajax
|
wait_for_ajax
|
||||||
# commented out: the notice is gone if you want to check for it
|
|
||||||
# wait_for_animations_to_end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I delete the todo "([^"]*)"$/ do |action_description|
|
When /^I delete the todo "([^"]*)"$/ do |action_description|
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,12 @@ module TracksStepHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def open_submenu_for(todo)
|
def open_submenu_for(todo)
|
||||||
|
wait_for_animations_to_end
|
||||||
|
|
||||||
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
|
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
|
||||||
page.should have_css(submenu_arrow, :visible=>true)
|
page.should have_css(submenu_arrow, :visible=>true)
|
||||||
page.find(submenu_arrow, :match => :first).click
|
arrow = page.find(submenu_arrow, :match => :first)
|
||||||
sleep 0.1
|
arrow.click
|
||||||
|
|
||||||
submenu_css = "div#line_todo_#{todo.id} ul#ultodo_#{todo.id}"
|
submenu_css = "div#line_todo_#{todo.id} ul#ultodo_#{todo.id}"
|
||||||
submenu = page.find(submenu_css)
|
submenu = page.find(submenu_css)
|
||||||
|
|
|
||||||
|
|
@ -136,9 +136,9 @@ Feature: Show done
|
||||||
@javascript
|
@javascript
|
||||||
Scenario Outline: I can toggle a todo active from the done pages
|
Scenario Outline: I can toggle a todo active from the done pages
|
||||||
When I go to the <page>
|
When I go to the <page>
|
||||||
Then I should see "todo 1"
|
Then I should see the todo "todo 1"
|
||||||
When I mark the completed todo "todo 1" active
|
When I mark the completed todo "todo 1" active
|
||||||
Then I should not see "todo 1"
|
Then I should not see the todo "todo 1"
|
||||||
When I go to the <next page>
|
When I go to the <next page>
|
||||||
Then I should see "todo 1" <where>
|
Then I should see "todo 1" <where>
|
||||||
|
|
||||||
|
|
@ -163,13 +163,13 @@ Feature: Show done
|
||||||
And I should see "todo 2" in the done this week container
|
And I should see "todo 2" in the done this week container
|
||||||
And I should see "todo 3" in the done this month container
|
And I should see "todo 3" in the done this month container
|
||||||
When I mark the completed todo "todo 1" active
|
When I mark the completed todo "todo 1" active
|
||||||
Then I should not see "todo 1"
|
Then I should not see the todo "todo 1"
|
||||||
And I should see empty message for done today of done actions
|
And I should see empty message for done today of done actions
|
||||||
When I mark the completed todo "todo 2" active
|
When I mark the completed todo "todo 2" active
|
||||||
Then I should not see "todo 2"
|
Then I should not see the todo "todo 2"
|
||||||
And I should see empty message for done this week of done actions
|
And I should see empty message for done this week of done actions
|
||||||
When I mark the completed todo "todo 3" active
|
When I mark the completed todo "todo 3" active
|
||||||
Then I should not see "todo 3"
|
Then I should not see the todo "todo 3"
|
||||||
And I should see empty message for done this month of done actions
|
And I should see empty message for done this month of done actions
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
|
|
@ -196,7 +196,7 @@ Feature: Show done
|
||||||
When I go to the done projects page
|
When I go to the done projects page
|
||||||
Then I should see "completed project"
|
Then I should see "completed project"
|
||||||
When I edit the project state of "completed project" to "active"
|
When I edit the project state of "completed project" to "active"
|
||||||
Then I should not see "completed project"
|
Then I should not see the project "completed project"
|
||||||
When I go to the projects page
|
When I go to the projects page
|
||||||
Then I should see "completed project"
|
Then I should see "completed project"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
class DoneTodos
|
class DoneTodos
|
||||||
|
|
||||||
|
|
||||||
def self.done_todos_for_container(user)
|
def self.done_todos_for_container(todos)
|
||||||
completed_todos = user.todos.completed
|
completed_todos = todos.completed
|
||||||
return done_today(completed_todos), done_rest_of_week(completed_todos), done_rest_of_month(completed_todos)
|
return done_today(completed_todos), done_rest_of_week(completed_todos), done_rest_of_month(completed_todos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -29,8 +29,8 @@ class DoneTodos
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.remaining_in_container(user, period)
|
def self.remaining_in_container(todos, period)
|
||||||
count = self.send("done_#{period}", user.todos.completed, {}).count
|
count = self.send("done_#{period}", todos.completed, {}).count
|
||||||
return nil if period.nil?
|
return nil if period.nil?
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue