fix failing cucumber scenario's and update gems

This commit is contained in:
Reinier Balt 2013-09-18 10:38:20 +02:00
parent 5164c404db
commit bbf6cdf702
8 changed files with 32 additions and 24 deletions

View file

@ -57,7 +57,7 @@ GEM
xpath (~> 2.0) xpath (~> 2.0)
childprocess (0.3.9) childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
codeclimate-test-reporter (0.0.8) codeclimate-test-reporter (0.0.9)
simplecov (>= 0.7.1, < 1.0.0) simplecov (>= 0.7.1, < 1.0.0)
coffee-rails (4.0.0) coffee-rails (4.0.0)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@ -137,7 +137,7 @@ GEM
rspec-expectations (2.14.2) rspec-expectations (2.14.2)
diff-lcs (>= 1.1.3, < 2.0) diff-lcs (>= 1.1.3, < 2.0)
rubyzip (0.9.9) rubyzip (0.9.9)
safe_yaml (0.9.5) safe_yaml (0.9.7)
sanitize (2.0.6) sanitize (2.0.6)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
sass (3.2.10) sass (3.2.10)

View file

@ -136,8 +136,8 @@ class ProjectsController < ApplicationController
limit(current_user.prefs.show_number_completed). limit(current_user.prefs.show_number_completed).
includes(Todo::DEFAULT_INCLUDES) unless @max_completed == 0 includes(Todo::DEFAULT_INCLUDES) unless @max_completed == 0
@count = @not_done_todos.size @down_count = @not_done_todos.size + @deferred_todos.size + @pending_todos.size
@down_count = @count + @deferred_todos.size + @pending_todos.size @count=@down_count
@next_project = current_user.projects.next_from(@project) @next_project = current_user.projects.next_from(@project)
@previous_project = current_user.projects.previous_from(@project) @previous_project = current_user.projects.previous_from(@project)
@default_tags = @project.default_tags @default_tags = @project.default_tags

View file

@ -123,6 +123,8 @@ class TodosController < ApplicationController
determine_down_count determine_down_count
@contexts = current_user.contexts @contexts = current_user.contexts
@projects = current_user.projects @projects = current_user.projects
@context = @todo.context
@project = @todo.project
@initial_context_name = params['default_context_name'] @initial_context_name = params['default_context_name']
@initial_project_name = params['default_project_name'] @initial_project_name = params['default_project_name']
@initial_tags = params['initial_tag_list'] @initial_tags = params['initial_tag_list']
@ -1163,18 +1165,18 @@ end
def update_context def update_context
@context_changed = false @context_changed = false
if params['todo']['context_id'].blank? && params['context_name'].present? if params['todo']['context_id'].blank? && params['context_name'].present?
context = current_user.contexts.where(:name => params['context_name'].strip).first @context = current_user.contexts.where(:name => params['context_name'].strip).first
unless context if @context.nil?
@new_context = current_user.contexts.build @new_context = current_user.contexts.build
@new_context.name = params['context_name'].strip @new_context.name = params['context_name'].strip
@new_context.save @new_context.save
@new_context_created = true @new_context_created = true
@new_container = @new_context @new_container = @new_context
@not_done_todos = [@todo] @not_done_todos = [@todo]
context = @new_context @context = @new_context
end end
params["todo"]["context_id"] = context.id params["todo"]["context_id"] = @context.id
@context_changed = @original_item_context_id != params["todo"]["context_id"] = context.id @context_changed = @original_item_context_id != params["todo"]["context_id"] = @context.id
end end
end end

View file

@ -575,6 +575,13 @@ module TodosHelper
return false return false
end end
def should_show_empty_container
source_view do |page|
page.context { return @remaining_in_context == 0 }
end
return @down_count==0
end
def project_container_id(todo) def project_container_id(todo)
return "p#{todo.project_id}" unless todo.project.nil? return "p#{todo.project_id}" unless todo.project.nil?
return "without_project_container" return "without_project_container"

View file

@ -42,7 +42,7 @@ function remove_todo(next_steps) {
function add_to_existing_container(next_steps) { function add_to_existing_container(next_steps) {
$('#<%= item_container_id(@todo) %>_items').append(html_for_todo()); $('#<%= item_container_id(@todo) %>_items').append(html_for_todo());
<% if source_view_is_one_of(:project,:calendar) -%> <% if source_view_is_one_of(:calendar) -%>
next_steps.go(); next_steps.go();
<% if (@target_context_count==1) || ( (@todo.deferred? || @todo.pending?) && @remaining_deferred_or_pending_count == 1) -%> <% if (@target_context_count==1) || ( (@todo.deferred? || @todo.pending?) && @remaining_deferred_or_pending_count == 1) -%>
$("#<%= empty_container_msg_div_id %>").slideUp(100); $("#<%= empty_container_msg_div_id %>").slideUp(100);
@ -83,7 +83,7 @@ function highlight_updated_todo(next_steps) {
} }
function update_empty_container(next_steps) { function update_empty_container(next_steps) {
<% if @down_count==0 -%> <% if should_show_empty_container -%>
$('div#no_todos_in_view').slideDown(400, function(){ next_steps.go(); }); $('div#no_todos_in_view').slideDown(400, function(){ next_steps.go(); });
<% else -%> <% else -%>
$('div#no_todos_in_view').fadeOut(100, function(){ next_steps.go(); }); $('div#no_todos_in_view').fadeOut(100, function(){ next_steps.go(); });

View file

@ -12,17 +12,16 @@ Feature: Edit a context
And I have a project called "test project" And I have a project called "test project"
And I have 2 todos in project "test project" in context "@pc" with tags "starred" prefixed by "test_project " And I have 2 todos in project "test project" in context "@pc" with tags "starred" prefixed by "test_project "
@javascript @javascript
Scenario: In place edit of context name Scenario: In place edit of context name
Given I have a context called "Errands" When I go to the context page for "@pc"
When I go to the context page for "Errands"
And I edit the context name in place to be "OutAndAbout" And I edit the context name in place to be "OutAndAbout"
Then I should see the context name is "OutAndAbout" Then I should see the context name is "OutAndAbout"
When I go to the contexts page When I go to the contexts page
Then I should see that a context named "Errands" is not present Then I should see that a context named "Errands" is not present
And I should see that a context named "OutAndAbout" is present And I should see that a context named "OutAndAbout" is present
@javascript @javascript
Scenario: Editing the context of a todo will remove the todo Scenario: Editing the context of a todo will remove the todo
When I go to the the context page for "@pc" When I go to the the context page for "@pc"
Then the badge should show 2 Then the badge should show 2
@ -37,7 +36,7 @@ Feature: Edit a context
Then I should not see the todo "test_project todo 1" Then I should not see the todo "test_project todo 1"
And I should see "changed" And I should see "changed"
@javascript @javascript
Scenario: Editing the context of the last todo will remove the todo and show empty message Scenario: Editing the context of the last todo will remove the todo and show empty message
When I go to the the context page for "@pc" When I go to the the context page for "@pc"
And I edit the context of "test_project todo 1" to "@laptop" And I edit the context of "test_project todo 1" to "@laptop"

View file

@ -45,7 +45,7 @@ end
# #
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
# # { :except => [:widgets] } may not do what you expect here # # { :except => [:widgets] } may not do what you expect here
# # as tCucumber::Rails::Database.javascript_strategy overrides # # as Cucumber::Rails::Database.javascript_strategy overrides
# # this setting. # # this setting.
# DatabaseCleaner.strategy = :truncation # DatabaseCleaner.strategy = :truncation
# end # end

View file

@ -1,6 +1,6 @@
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a # It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file # newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb # instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files. # files.
@ -14,19 +14,19 @@ begin
require 'cucumber/rake/task' require 'cucumber/rake/task'
namespace :cucumber do namespace :cucumber do
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
t.fork = true # You may get faster startup if you set this to false t.fork = true # You may get faster startup if you set this to false
t.profile = 'default' t.profile = 'default'
end end
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
t.binary = vendored_cucumber_bin t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false t.fork = true # You may get faster startup if you set this to false
t.profile = 'wip' t.profile = 'wip'
end end
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
t.binary = vendored_cucumber_bin t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false t.fork = true # You may get faster startup if you set this to false
t.profile = 'rerun' t.profile = 'rerun'
@ -50,8 +50,8 @@ begin
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
end end
# In case we don't have ActiveRecord, append a no-op task that we can depend upon. # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
task 'db:test:prepare' do task 'test:prepare' do
end end
task :stats => 'cucumber:statsetup' task :stats => 'cucumber:statsetup'