diff --git a/.gitignore b/.gitignore
index b418ad46..0dc4677e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@
/.bundle
/.emacs-project
/.redcar
-/bin
/coverage
/db/*.db
/db/*.sqlite3
diff --git a/.travis.yml b/.travis.yml
index 5eeee3cb..9f4cf629 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,16 +8,18 @@ rvm:
bundler_args: --without development
before_install:
-before_install:
- - "gem install bundler -v=1.5.1"
- "mysql -e 'create database tracks_test;'"
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "cp config/site.yml.tmpl config/site.yml"
- "cp config/database.yml.tmpl config/database.yml"
-script: "CODECLIMATE_REPO_TOKEN=5c52fdd2bbcd0734d56ddb2c3cbaac782da345273e8689d25f54a065ccc3397c bundle exec rake ci RACK_ENV=test"
+script: "bin/rake ci"
notifications:
email: false
+addons:
+ code_climate:
+ repo_token:
+ secure: Ev0v5x9abxM+vlCdY7J/AHMP/Eq9FlhFtNlKSMnD3n2I1xWT0oB5kgidS3L+U0/janXxf4aNe28rDcj5AUePSoNBiSg6wzZ95D3Dz7AxqL9i61IQ/hllpA1kzQrTUsXtS5qAqa3H90Ev5hTQQahExjGvLB+1t8Ea2JBLR+8nUvU=
diff --git a/Gemfile b/Gemfile
index f28652b7..4b7c6d04 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,13 +1,13 @@
source 'https://rubygems.org'
-gem 'rails', '~>4.0.0'
-gem 'sass-rails', '~>4.0.0'
-gem 'coffee-rails', '~>4.0.0'
+gem 'rails', '~>4.1.0'
+gem 'sass-rails', '~>4.0'
+gem 'coffee-rails', '~>4.0'
-gem 'json'
+#gem 'json'
# todo: remove xml api
-gem 'actionpack-xml_parser', git: 'https://github.com/rails/actionpack-xml_parser'
+gem 'actionpack-xml_parser', '>=1.0.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer'
@@ -38,10 +38,9 @@ gem "htmlentities"
gem "swf_fu"
gem "rails_autolink"
gem "cache_digests"
-gem "highline" # for reset_password rake task
# To use ActiveModel has_secure_password
-gem 'bcrypt-ruby', '~> 3.0.0'
+gem 'bcrypt', '~> 3.1.7'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
@@ -50,8 +49,10 @@ gem 'turbolinks'
# gem 'jbuilder', '~> 1.2'
group :development do
+ gem "spring"
+ gem "spring-commands-cucumber"
gem "yard"
- gem "tolk", git: 'https://github.com/tolk/tolk'
+ gem 'tolk', '>=1.5.0'
gem "bullet"
gem "rack-mini-profiler"
end
@@ -64,8 +65,7 @@ group :test do
gem "database_cleaner"
gem "mocha", :require => false
- gem "aruba", git: 'https://github.com/cucumber/aruba', :require => false # need 0.5.4 for piping files; 0.5.3 is latest
- gem "timecop", "~> 0.6.2"
+ gem "aruba", ">=0.5.4", :require => false
# Note that > 2.14 has problems, see:
# https://code.google.com/p/selenium/issues/detail?id=3075
diff --git a/Gemfile.lock b/Gemfile.lock
index 40c7041f..e69de29b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,262 +0,0 @@
-GIT
- remote: https://github.com/cucumber/aruba
- revision: fccb412d18d699b7ecacd0da6b2e5338987cf4eb
- specs:
- aruba (0.5.4)
- childprocess (>= 0.3.6)
- cucumber (>= 1.1.1)
- rspec-expectations (>= 2.7.0)
-
-GIT
- remote: https://github.com/rails/actionpack-xml_parser
- revision: e1516064761ea26502cd79b283f6af0fa2b1edf5
- specs:
- actionpack-xml_parser (1.0.1)
- actionpack (>= 4.0.0, < 5)
-
-GIT
- remote: https://github.com/tolk/tolk
- revision: 06f99b3b747f2f8f7297fa35ec9c9d5f38eaada6
- specs:
- tolk (1.4.00)
- safe_yaml (~> 0.8)
- will_paginate
-
-GEM
- remote: https://rubygems.org/
- specs:
- RedCloth (4.2.9)
- aasm (3.1.1)
- actionmailer (4.0.4)
- actionpack (= 4.0.4)
- mail (~> 2.5.4)
- actionpack (4.0.4)
- activesupport (= 4.0.4)
- builder (~> 3.1.0)
- erubis (~> 2.7.0)
- rack (~> 1.5.2)
- rack-test (~> 0.6.2)
- activemodel (4.0.4)
- activesupport (= 4.0.4)
- builder (~> 3.1.0)
- activerecord (4.0.4)
- activemodel (= 4.0.4)
- activerecord-deprecated_finders (~> 1.0.2)
- activesupport (= 4.0.4)
- arel (~> 4.0.0)
- activerecord-deprecated_finders (1.0.3)
- activesupport (4.0.4)
- i18n (~> 0.6, >= 0.6.9)
- minitest (~> 4.2)
- multi_json (~> 1.3)
- thread_safe (~> 0.1)
- tzinfo (~> 0.3.37)
- acts_as_list (0.4.0)
- activerecord (>= 3.0)
- arel (4.0.2)
- atomic (1.1.16)
- bcrypt-ruby (3.0.1)
- bootstrap-sass (3.1.1.0)
- sass (~> 3.2)
- builder (3.1.4)
- bullet (4.8.0)
- activesupport
- uniform_notifier (>= 1.4.0)
- cache_digests (0.3.1)
- actionpack (>= 3.2)
- thread_safe
- capybara (2.2.1)
- mime-types (>= 1.16)
- nokogiri (>= 1.3.3)
- rack (>= 1.0.0)
- rack-test (>= 0.5.4)
- xpath (~> 2.0)
- childprocess (0.5.2)
- ffi (~> 1.0, >= 1.0.11)
- codeclimate-test-reporter (0.3.0)
- simplecov (>= 0.7.1, < 1.0.0)
- coffee-rails (4.0.1)
- coffee-script (>= 2.2.0)
- railties (>= 4.0.0, < 5.0)
- coffee-script (2.2.0)
- coffee-script-source
- execjs
- coffee-script-source (1.7.0)
- cucumber (1.3.14)
- builder (>= 2.1.2)
- diff-lcs (>= 1.1.3)
- gherkin (~> 2.12)
- multi_json (>= 1.7.5, < 2.0)
- multi_test (>= 0.1.1)
- cucumber-rails (1.4.0)
- capybara (>= 1.1.2)
- cucumber (>= 1.2.0)
- nokogiri (>= 1.5.0)
- rails (>= 3.0.0)
- database_cleaner (1.2.0)
- diff-lcs (1.2.5)
- docile (1.1.3)
- erubis (2.7.0)
- execjs (2.0.2)
- factory_girl (4.4.0)
- activesupport (>= 3.0.0)
- factory_girl_rails (4.4.1)
- factory_girl (~> 4.4.0)
- railties (>= 3.0.0)
- ffi (1.9.3)
- font-awesome-sass (4.0.3.1)
- sass (~> 3.2)
- gherkin (2.12.2)
- multi_json (~> 1.3)
- highline (1.6.21)
- hike (1.2.3)
- htmlentities (4.3.1)
- i18n (0.6.9)
- jquery-rails (3.1.0)
- railties (>= 3.0, < 5.0)
- thor (>= 0.14, < 2.0)
- json (1.8.1)
- libv8 (3.16.14.3)
- mail (2.5.4)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- metaclass (0.0.4)
- mime-types (1.25.1)
- mini_portile (0.5.3)
- minitest (4.7.5)
- mocha (1.0.0)
- metaclass (~> 0.0.1)
- mousetrap-rails (1.4.6)
- multi_json (1.9.2)
- multi_test (0.1.1)
- mysql2 (0.3.15)
- nokogiri (1.6.1)
- mini_portile (~> 0.5.0)
- polyglot (0.3.4)
- rack (1.5.2)
- rack-mini-profiler (0.9.1)
- rack (>= 1.1.3)
- rack-test (0.6.2)
- rack (>= 1.0)
- rails (4.0.4)
- actionmailer (= 4.0.4)
- actionpack (= 4.0.4)
- activerecord (= 4.0.4)
- activesupport (= 4.0.4)
- bundler (>= 1.3.0, < 2.0)
- railties (= 4.0.4)
- sprockets-rails (~> 2.0.0)
- rails_autolink (1.1.5)
- rails (> 3.1)
- railties (4.0.4)
- actionpack (= 4.0.4)
- activesupport (= 4.0.4)
- rake (>= 0.8.7)
- thor (>= 0.18.1, < 2.0)
- rake (10.2.2)
- ref (1.0.5)
- rspec-expectations (2.14.5)
- diff-lcs (>= 1.1.3, < 2.0)
- rubyzip (1.1.2)
- safe_yaml (0.9.7)
- sanitize (2.1.0)
- nokogiri (>= 1.4.4)
- sass (3.2.18)
- sass-rails (4.0.2)
- railties (>= 4.0.0, < 5.0)
- sass (~> 3.2.0)
- sprockets (~> 2.8, <= 2.11.0)
- sprockets-rails (~> 2.0.0)
- selenium-webdriver (2.40.0)
- childprocess (>= 0.5.0)
- multi_json (~> 1.0)
- rubyzip (~> 1.0)
- websocket (~> 1.0.4)
- simplecov (0.8.2)
- docile (~> 1.1.0)
- multi_json
- simplecov-html (~> 0.8.0)
- simplecov-html (0.8.0)
- sprockets (2.11.0)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.0.1)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- sprockets (~> 2.8)
- sqlite3 (1.3.9)
- swf_fu (2.0.4)
- coffee-script
- rails (>= 3.1)
- therubyracer (0.12.1)
- libv8 (~> 3.16.14.0)
- ref
- thor (0.19.1)
- thread_safe (0.3.1)
- atomic (>= 1.1.7, < 2)
- tilt (1.4.1)
- timecop (0.6.3)
- treetop (1.4.15)
- polyglot
- polyglot (>= 0.3.1)
- turbolinks (2.2.1)
- coffee-rails
- tzinfo (0.3.39)
- uglifier (2.5.0)
- execjs (>= 0.3.0)
- json (>= 1.8.0)
- uniform_notifier (1.4.0)
- websocket (1.0.7)
- will_paginate (3.0.5)
- will_paginate-bootstrap (1.0.0)
- will_paginate (>= 3.0.3)
- xpath (2.0.0)
- nokogiri (~> 1.3)
- yard (0.8.7.4)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- RedCloth
- aasm
- actionpack-xml_parser!
- acts_as_list
- aruba!
- bcrypt-ruby (~> 3.0.0)
- bootstrap-sass
- bullet
- cache_digests
- capybara
- codeclimate-test-reporter
- coffee-rails (~> 4.0.0)
- cucumber-rails
- database_cleaner
- factory_girl_rails
- font-awesome-sass
- highline
- htmlentities
- jquery-rails
- json
- mocha
- mousetrap-rails
- mysql2
- rack-mini-profiler
- rails (~> 4.0.0)
- rails_autolink
- rspec-expectations
- sanitize
- sass-rails (~> 4.0.0)
- selenium-webdriver
- simplecov
- sqlite3
- swf_fu
- therubyracer
- timecop (~> 0.6.2)
- tolk!
- turbolinks
- uglifier (>= 1.3.0)
- will_paginate-bootstrap
- yard
diff --git a/README.md b/README.md
index c91461c3..13d205cd 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Tracks: a GTD(TM) web application, built with Ruby on Rails
-Copyright (C) 2004-2013 rousette.org.uk
+Copyright (C) 2004-2014 rousette.org.uk
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -9,9 +9,8 @@ of the License, or (at your option) any later version.
* Project homepage: http://getontracks.org/
* Manual: http://getontracks.org/manual/
* Source at GitHub: https://github.com/TracksApp/tracks
-* Assembla space (for bug reports and feature requests): https://www.assembla.com/spaces/tracks-tickets/tickets
+* Bug reports and feature requests: https://github.com/TracksApp/tracks/issues
* Wiki (community contributed information): https://github.com/TracksApp/tracks/wiki
-* Forum (read-only): http://getontracks.org/forums/
* Mailing list: http://groups.google.com/group/TracksApp
* Original developer: bsag (http://www.rousette.org.uk/)
* Contributors: https://github.com/TracksApp/tracks/wiki/Contributors
@@ -19,6 +18,7 @@ of the License, or (at your option) any later version.
[](https://travis-ci.org/TracksApp/tracks)
[](https://codeclimate.com/github/TracksApp/tracks)
+[](https://gemnasium.com/TracksApp/tracks)
Full instructions for both new installations and upgrades from older installations of Tracks
can be found within the /doc directory.
@@ -29,7 +29,7 @@ different configurations which can be used (e.g. running Tracks on your local
computer or on a remote server). If you choose the appropriate section for your
situation (installation vs. upgrade), and use the easiest (recommended) method,
you should find the instructions easy to follow. If you encounter problems, try
-searching the wiki, forum or mailing list (URLs above), and ask a question if
+searching the wiki or mailing list (URLs above), and ask a question if
you cannot find a solution to your problem.
The wiki has a lot of user contributed installation HOWTOs for various webhosts, specific OS's and more.
diff --git a/Rakefile b/Rakefile
index b91c5b29..ba6b733d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -3,4 +3,4 @@
require File.expand_path('../config/application', __FILE__)
-Tracksapp::Application.load_tasks
+Rails.application.load_tasks
diff --git a/app/assets/images/next.png b/app/assets/images/next.png
new file mode 100644
index 00000000..66a258d1
Binary files /dev/null and b/app/assets/images/next.png differ
diff --git a/app/assets/images/previous.png b/app/assets/images/previous.png
new file mode 100644
index 00000000..e0a2b6c5
Binary files /dev/null and b/app/assets/images/previous.png differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 3e785263..aa3ae31a 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -12,9 +12,7 @@
//
//= require jquery
//= require jquery_ujs
-//
//= require bootstrap
-//
//= require mousetrap
//
// Stuff in vendor/assets
@@ -32,4 +30,5 @@
//
// Stuff in app/assets
//= require tracks.js
-//= require keybindings.js
+//= require disable_fx_in_test
+//= require keybindings.js
\ No newline at end of file
diff --git a/app/assets/javascripts/disable_fx_in_test.js.erb b/app/assets/javascripts/disable_fx_in_test.js.erb
new file mode 100644
index 00000000..89064c9d
--- /dev/null
+++ b/app/assets/javascripts/disable_fx_in_test.js.erb
@@ -0,0 +1,3 @@
+<% if Rails.env.test? || Rails.env.cucumber? %>
+$.fx.off = true;
+<% end %>
diff --git a/app/assets/javascripts/tracks.old.js b/app/assets/javascripts/tracks.old.js
index 91301cc9..908eb6d5 100644
--- a/app/assets/javascripts/tracks.old.js
+++ b/app/assets/javascripts/tracks.old.js
@@ -588,7 +588,7 @@ var TodoItems = {
$(document).on("click",'.item-container a.delete_dependency_button', function(evt){
var predecessor_id=$(this).attr("x_predecessors_id");
var ajax_options = default_ajax_options_for_scripts('DELETE', this.href, $(this).parents('.item-container'));
- ajax_options.data << {predecessor: predecessor_id}
+ ajax_options.data["predecessor"] = predecessor_id
$.ajax(ajax_options);
return false;
});
@@ -1245,7 +1245,7 @@ function setup_periodic_check(url_for_check, interval_in_sec, method) {
function(){
var settings = default_ajax_options_for_scripts( method ? method : "GET", url_for_check, null);
if(typeof(AUTH_TOKEN) != 'undefined'){
- settings.data << {authenticity_token: AUTH_TOKEN}
+ settings.data["authenticity_token"] = AUTH_TOKEN
}
$.ajax(settings);
},
diff --git a/app/controllers/calendar_controller.rb b/app/controllers/calendar_controller.rb
index 51b8cabc..dc00bcca 100644
--- a/app/controllers/calendar_controller.rb
+++ b/app/controllers/calendar_controller.rb
@@ -13,6 +13,9 @@ class CalendarController < ApplicationController
respond_to do |format|
format.html
+ format.m {
+ cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
+ }
format.ics {
render :action => 'show', :layout => false, :content_type => Mime::ICS
}
diff --git a/app/controllers/mailgun_controller.rb b/app/controllers/mailgun_controller.rb
index 83e6fe78..614d185e 100644
--- a/app/controllers/mailgun_controller.rb
+++ b/app/controllers/mailgun_controller.rb
@@ -25,7 +25,7 @@ class MailgunController < ApplicationController
def verify
unless params['signature'] == OpenSSL::HMAC.hexdigest(
- OpenSSL::Digest::Digest.new('sha256'),
+ OpenSSL::Digest.new('sha256'),
SITE_CONFIG['mailgun_api_key'],
'%s%s' % [params['timestamp'], params['token']]
)
diff --git a/app/controllers/recurring_todos_controller.rb b/app/controllers/recurring_todos_controller.rb
index a15f6922..8fe403b9 100644
--- a/app/controllers/recurring_todos_controller.rb
+++ b/app/controllers/recurring_todos_controller.rb
@@ -70,6 +70,7 @@ class RecurringTodosController < ApplicationController
@down_count = current_user.recurring_todos.active.count
@new_recurring_todo = RecurringTodo.new
else
+ @recurring_todo = builder.recurring_todo
@status_message = t('todos.error_saving_recurring')
end
diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb
index a2490acc..7a41d091 100644
--- a/app/controllers/stats_controller.rb
+++ b/app/controllers/stats_controller.rb
@@ -34,8 +34,8 @@ class StatsController < ApplicationController
@interpolated_actions_created_this_month = interpolate_avg_for_current_month(@actions_created_last12months_array)
@interpolated_actions_done_this_month = interpolate_avg_for_current_month(@actions_done_last12months_array)
- @created_count_array = Array.new(13, actions_last12months.created_after(@cut_off_year).count/12.0)
- @done_count_array = Array.new(13, actions_last12months.completed_after(@cut_off_year).count/12.0)
+ @created_count_array = Array.new(13, actions_last12months.created_after(@cut_off_year).count(:all)/12.0)
+ @done_count_array = Array.new(13, actions_last12months.completed_after(@cut_off_year).count(:all)/12.0)
render :layout => false
end
@@ -110,7 +110,7 @@ class StatsController < ApplicationController
@max_actions = @actions_completion_time_array.max
# get percentage done cumulative
- @cum_percent_done = convert_to_cumulative_array(@actions_completion_time_array, @actions_completion_time.count)
+ @cum_percent_done = convert_to_cumulative_array(@actions_completion_time_array, @actions_completion_time.count(:all))
render :layout => false
end
diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb
index 9c1138b1..839d3b6f 100644
--- a/app/controllers/todos_controller.rb
+++ b/app/controllers/todos_controller.rb
@@ -49,7 +49,10 @@ class TodosController < ApplicationController
headers['Content-Type']=Mime::TEXT.to_s
render :content_type => Mime::TEXT
end
- format.xml { render :xml => @todos.to_xml( *todo_xml_params ) }
+ format.xml do
+ @xml_todos = params[:limit_to_active_todos] ? @not_done_todos : @todos
+ render :xml => @xml_todos.to_xml( *todo_xml_params )
+ end
format.any(:rss, :atom) { @feed_title, @feed_description = 'Tracks Actions', "Actions for #{current_user.display_name}" }
format.ics
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 24193369..c5830555 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -21,7 +21,7 @@ module ApplicationHelper
end
def days_from_today(date)
- (date.in_time_zone.to_date - UserTime.new(current_user).date).to_i
+ (date.in_time_zone.to_date - Date.current).to_i
end
# Check due date in comparison to today's date Flag up date appropriately with
diff --git a/app/helpers/stats_helper.rb b/app/helpers/stats_helper.rb
old mode 100755
new mode 100644
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 9f7ea0da..63f376d3 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -228,7 +228,7 @@ module TodosHelper
def remote_toggle_checkbox(todo=@todo)
check_box_tag("mark_complete_#{todo.id}", toggle_check_todo_path(todo), todo.completed?, :class => 'item-checkbox',
- :title => todo.pending? ? t('todos.blocked_by', :predecessors => todo.uncompleted_predecessors.map(&:description).join(', ')) : "", :readonly => todo.pending?)
+ :title => todo.pending? ? t('todos.blocked_by', :predecessors => todo.uncompleted_predecessors.to_a.map(&:description).join(', ')) : "", :readonly => todo.pending?)
end
def remote_mobile_checkbox(todo=@todo)
@@ -241,8 +241,8 @@ module TodosHelper
if todo.completed?
content_tag(:span, {class: "label"}) { format_date( todo.completed_at ) }
elsif todo.pending?
- title = t('todos.depends_on')+ ": " + todo.uncompleted_predecessors.map(&:description).join(', ')
- content_tag(:a, {:title => title}) { content_tag(:span, {class: "label label-info"}) { t('todos.pending') } }
+ title = t('todos.depends_on')+ ": " + todo.uncompleted_predecessors.to_a.map(&:description).join(', ')
+ content_tag(:a, {:title => title}) { content_tag(:span, {:class => :orange}) { t('todos.pending') } }
elsif todo.deferred?
show_date( todo.show_from )
else
@@ -253,7 +253,7 @@ module TodosHelper
def successors_span(todo=@todo)
unless todo.pending_successors.empty?
pending_count = todo.pending_successors.count
- title = "#{t('todos.has_x_pending', :count => pending_count)}: #{todo.pending_successors.map(&:description).join(', ')}"
+ title = "#{t('todos.has_x_pending', :count => pending_count)}: #{todo.pending_successors.to_a.map(&:description).join(', ')}"
image_tag( 'successor_off.png', :width=>'10', :height=>'16', :border=>'0', :title => title )
end
end
@@ -267,7 +267,7 @@ module TodosHelper
end
def tag_list_text(todo=@todo)
- todo.tags.join(', ')
+ todo.tags.to_a.join(', ')
end
def tag_span (tag, mobile=false)
@@ -498,7 +498,14 @@ module TodosHelper
end
def todo_moved_out_of_container
- return (@project_changed && @group_view_by=='project') || (@context_changed && @group_view_by=='context')
+ # moved from one project container to another
+ moved_project = @project_changed && @group_view_by=='project'
+ # moved from one context container to another
+ moved_context = @context_changed && @group_view_by=='context'
+ # moved from actions-without-project container to another
+ moved_without_project = @context_changed && @group_view_by=='project' && @todo.project_id.nil?
+
+ return moved_project || moved_context || moved_without_project
end
def update_needs_to_hide_container
diff --git a/app/models/preference.rb b/app/models/preference.rb
index e0150cd8..c4ccb5f1 100644
--- a/app/models/preference.rb
+++ b/app/models/preference.rb
@@ -15,13 +15,13 @@ class Preference < ActiveRecord::Base
date = nil
if s.is_a?(Time)
- date = s.in_time_zone(time_zone).to_date
+ date = s.to_date
elsif s.is_a?(String)
date = Date.strptime(s, date_format)
else
raise ArgumentError.new("Bad argument type:#{s.class}")
end
- UserTime.new(user).midnight(date)
+ date.in_time_zone(time_zone).beginning_of_day
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 834428b0..913b8127 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -101,9 +101,8 @@ class Project < ActiveRecord::Base
end
def needs_review?(user)
- current_time = UserTime.new(user).time
return active? && ( last_reviewed.nil? ||
- (last_reviewed < current_time - user.prefs.review_period.days))
+ (last_reviewed < Time.current - user.prefs.review_period.days))
end
def blocked?
@@ -175,4 +174,8 @@ class NullProject
""
end
+ def persisted?
+ false
+ end
+
end
diff --git a/app/models/recurring_todos/monthly_recurring_todos_builder.rb b/app/models/recurring_todos/monthly_recurring_todos_builder.rb
index a70cd257..df88b597 100644
--- a/app/models/recurring_todos/monthly_recurring_todos_builder.rb
+++ b/app/models/recurring_todos/monthly_recurring_todos_builder.rb
@@ -1,6 +1,7 @@
module RecurringTodos
class MonthlyRecurringTodosBuilder < AbstractRecurringTodosBuilder
+ attr_reader :recurring_todo
def initialize(user, attributes)
super(user, attributes, MonthlyRepeatPattern)
@@ -42,4 +43,4 @@ module RecurringTodos
end
-end
\ No newline at end of file
+end
diff --git a/app/models/recurring_todos/weekly_recurring_todos_builder.rb b/app/models/recurring_todos/weekly_recurring_todos_builder.rb
index 8a5254ca..3ff60296 100644
--- a/app/models/recurring_todos/weekly_recurring_todos_builder.rb
+++ b/app/models/recurring_todos/weekly_recurring_todos_builder.rb
@@ -1,6 +1,7 @@
module RecurringTodos
class WeeklyRecurringTodosBuilder < AbstractRecurringTodosBuilder
+ attr_reader :recurring_todo
def initialize(user, attributes)
super(user, attributes, WeeklyRepeatPattern)
@@ -39,4 +40,4 @@ module RecurringTodos
end
-end
\ No newline at end of file
+end
diff --git a/app/models/recurring_todos/yearly_recurring_todos_builder.rb b/app/models/recurring_todos/yearly_recurring_todos_builder.rb
index 091509d6..f4c795f8 100644
--- a/app/models/recurring_todos/yearly_recurring_todos_builder.rb
+++ b/app/models/recurring_todos/yearly_recurring_todos_builder.rb
@@ -1,6 +1,7 @@
module RecurringTodos
class YearlyRecurringTodosBuilder < AbstractRecurringTodosBuilder
+ attr_reader :recurring_todo
def initialize(user, attributes)
super(user, attributes, YearlyRepeatPattern)
@@ -41,4 +42,4 @@ module RecurringTodos
end
-end
\ No newline at end of file
+end
diff --git a/app/models/todo.rb b/app/models/todo.rb
index 2c37cf4b..0560fb6e 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -207,6 +207,7 @@ class Todo < ActiveRecord::Base
def remove_predecessor(predecessor)
self.predecessors.delete(predecessor)
if self.predecessors.empty?
+ self.reload # reload predecessors
self.not_part_of_hidden_container? ? self.activate! : self.hide!
else
save!
@@ -263,7 +264,7 @@ class Todo < ActiveRecord::Base
activate
else
# parse Date objects into the proper timezone
- date = UserTime.new(user).midnight(date) if (date.is_a? Date)
+ date = date.in_time_zone.beginning_of_day if (date.is_a? Date)
# show_from needs to be set before state_change because of "bug" in aasm.
# If show_from is not set, the todo will not validate and thus aasm will not save
diff --git a/app/models/user.rb b/app/models/user.rb
index 90f59d16..f93ccfac 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -56,13 +56,13 @@ class User < ActiveRecord::Base
end
def alphabetize(scope_conditions = {})
projects = where(scope_conditions)
- projects.sort!{ |x,y| x.name.downcase <=> y.name.downcase }
+ projects.to_a.sort!{ |x,y| x.name.downcase <=> y.name.downcase }
self.update_positions(projects.map{ |p| p.id })
return projects
end
def actionize(scope_conditions = {})
todos_in_project = where(scope_conditions).includes(:todos)
- todos_in_project.sort!{ |x, y| -(x.todos.active.count <=> y.todos.active.count) }
+ todos_in_project.to_a.sort!{ |x, y| -(x.todos.active.count <=> y.todos.active.count) }
todos_in_project.reject{ |p| p.todos.active.count > 0 }
sorted_project_ids = todos_in_project.map {|p| p.id}
@@ -90,7 +90,7 @@ class User < ActiveRecord::Base
order('show_from ASC, todos.created_at DESC')},
:class_name => 'Todo') do
def find_and_activate_ready
- where('show_from <= ?', Time.zone.now).collect { |t| t.activate! }
+ where('show_from <= ?', Time.current).collect { |t| t.activate! }
end
end
@@ -160,7 +160,7 @@ class User < ActiveRecord::Base
end
def date
- UserTime.new(self).midnight(Time.now)
+ Date.current
end
def generate_token
diff --git a/app/views/calendar/show.m.erb b/app/views/calendar/show.m.erb
new file mode 100644
index 00000000..ff4974fc
--- /dev/null
+++ b/app/views/calendar/show.m.erb
@@ -0,0 +1,5 @@
+<%= todos_calendar_container(:due_today, @calendar.due_today ) %>
+<%= todos_calendar_container(:due_this_week, @calendar.due_this_week ) %>
+<%= todos_calendar_container(:due_next_week, @calendar.due_next_week ) %>
+<%= todos_calendar_container(:due_this_month, @calendar.due_this_month ) %>
+<%= todos_calendar_container(:due_after_this_month, @calendar.due_after_this_month) %>
diff --git a/app/views/integrations/index.de.html.erb b/app/views/integrations/index.de.html.erb
index efaa2136..70bc29d2 100644
--- a/app/views/integrations/index.de.html.erb
+++ b/app/views/integrations/index.de.html.erb
@@ -105,7 +105,7 @@
"<%= Preference.human_attribute_name('sms_context') %>" for todos sent in
via email (which could come from an SMS message)
In sendmail/qmail/postfix/whatever, set up an email address
- alias to pipe messages to
/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'
+ alias to pipe messages to
/PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'
Send an email to your newly configured address!
You can also use the Rich Todo API to send in tasks like "do laundry @ Home"
@@ -116,7 +116,7 @@
You may need to configure your site.yml to tell the message gateway to look at the to: field or from: field to
lookup Tracks' user from the email address in that field.
You can also send all email to a specific Tracks user. Configure mail_dispatch in site.yml to single_user and pass the login of the user:
-
TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'
+
TRACKS_MAIL_RECEIVER=<%=current_user.login%> /PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'
diff --git a/app/views/integrations/index.en.html.erb b/app/views/integrations/index.en.html.erb
index 0dc900a2..55bafc63 100644
--- a/app/views/integrations/index.en.html.erb
+++ b/app/views/integrations/index.en.html.erb
@@ -107,7 +107,7 @@
"<%= Preference.human_attribute_name('sms_context') %>" for todos sent in
via email (which could come from an SMS message)
In sendmail/qmail/postfix/whatever, set up an email address
- alias to pipe messages to
/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'
+ alias to pipe messages to
/PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'
Send an email to your newly configured address!
You can also use the Rich Todo API to send in tasks like "do laundry @ Home"
@@ -118,7 +118,7 @@
You may need to configure your site.yml to tell the message gateway to look at the to: field or from: field to
lookup Tracks' user from the email address in that field.
You can also send all email to a specific Tracks user. Configure mail_dispatch in site.yml to single_user and pass the login of the user:
-
TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'
+
TRACKS_MAIL_RECEIVER=<%=current_user.login%> /PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'
diff --git a/app/views/integrations/index.nl.html.erb b/app/views/integrations/index.nl.html.erb
index aaf6abcb..666f78f9 100644
--- a/app/views/integrations/index.nl.html.erb
+++ b/app/views/integrations/index.nl.html.erb
@@ -109,7 +109,7 @@
verzonden zijn via email (die bijv. komen via een SMS message)
In sendmail/qmail/postfix/whatever, stel een email address
alias in om berichten door te sturen naar
-
/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'
+
/PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'
Verstuur een email naar het net geconfigureerde e-mail adres!
Je kan ook de Rich Todo API gebruiken om acties te maken zoals "do laundry @ Home"
@@ -120,7 +120,7 @@
Het kan nodig zijn om jouw site.yml te configureren om de message gateway te laten kijken naar het to: veld of het from: veld om
de Tracks-gebruiker op te zoeken met het emailadres uit dat veld.
Je kan ook alle email naar een specifieke Tracks gebruiker sturen. Stel mail_dispatch in site.yml in op single_user en geeft de login van de gebruiker door:
-
TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'
+
TRACKS_MAIL_RECEIVER=<%=current_user.login%> /PATH/TO/TRACKS/bin/rails r -e production 'MessageGateway.receive(STDIN.read)'
diff --git a/app/views/integrations/rest_api.html.erb b/app/views/integrations/rest_api.html.erb
index f52eb413..277d0eaf 100644
--- a/app/views/integrations/rest_api.html.erb
+++ b/app/views/integrations/rest_api.html.erb
@@ -79,6 +79,15 @@ field to ID, created_at, modified_at, completed_at by adding the pa
+If you only want to get the active todos, you add the parameter limit_to_active_todos and set it to some value like this:
+
+
diff --git a/app/views/todos/calendar.ics.erb b/app/views/todos/calendar.ics.erb
deleted file mode 100644
index 221216ea..00000000
--- a/app/views/todos/calendar.ics.erb
+++ /dev/null
@@ -1,32 +0,0 @@
-BEGIN:VCALENDAR
-PRODID:-//TRACKS//<%= TRACKS_VERSION %>//EN
-VERSION:2.0
-CALSCALE:GREGORIAN
-METHOD:PUBLISH
-X-WR-CALNAME:Tracks
-<% for todo in @due_all
- due_date = todo.due
- overdue_text = ""
- if due_date.at_midnight < Time.zone.now.at_midnight
- due_date = Time.zone.now
- overdue_text = t('todos.overdue') +": "
- end
- modified = todo.updated_at || todo.created_at
-%>BEGIN:VEVENT
-DTSTART;VALUE=DATE:<%= due_date.strftime("%Y%m%d") %>
-DTEND;VALUE=DATE:<%= (due_date+1.day).strftime("%Y%m%d") %>
-DTSTAMP:<%= due_date.strftime("%Y%m%dT%H%M%SZ") %>
-UID:<%= todo_url(todo) %>
-CLASS:PUBLIC
-CATEGORIES:Tracks
-CREATED:<%= todo.created_at.strftime("%Y%m%dT%H%M%SZ") %>
-DESCRIPTION:<%= format_ical_notes(todo.notes) %>
-LAST-MODIFIED:<%= modified.strftime("%Y%m%dT%H%M%SZ") %>
-LOCATION:
-SEQUENCE:0
-STATUS:CONFIRMED
-SUMMARY:<%= overdue_text + todo.description %>
-TRANSP:TRANSPARENT
-END:VEVENT
-<% end
-%>END:VCALENDAR
diff --git a/app/views/todos/remove_predecessor.js.erb b/app/views/todos/remove_predecessor.js.erb
index a2f49f2a..a53c505f 100644
--- a/app/views/todos/remove_predecessor.js.erb
+++ b/app/views/todos/remove_predecessor.js.erb
@@ -15,7 +15,7 @@ function replace_updated_predecessor() {
function regenerate_predecessor_family() {
<%
- parents = @predecessors
+ parents = @predecessors.to_a
until parents.empty?
parent = parents.pop
parents += parent.predecessors -%>
diff --git a/app/views/todos/toggle_check.js.erb b/app/views/todos/toggle_check.js.erb
index 17567222..ef465984 100644
--- a/app/views/todos/toggle_check.js.erb
+++ b/app/views/todos/toggle_check.js.erb
@@ -159,7 +159,7 @@ function block_predecessors(next_steps) {
function regenerate_predecessor_family(next_steps) {
<%
if @predecessors
- parents = @predecessors
+ parents = @predecessors.to_a
until parents.empty?
parent = parents.pop
parents += parent.predecessors -%>
diff --git a/app/views/todos/update.js.erb b/app/views/todos/update.js.erb
index 5f7b3ce0..23187fa4 100644
--- a/app/views/todos/update.js.erb
+++ b/app/views/todos/update.js.erb
@@ -125,7 +125,7 @@ function update_predecessors(next_steps) {
function regenerate_predecessor_family() {
<%
- parents = @todo.predecessors
+ parents = @todo.predecessors.to_a
until parents.empty?
parent = parents.pop
parents += parent.predecessors
diff --git a/bin/cucumber b/bin/cucumber
new file mode 100755
index 00000000..12971cdc
--- /dev/null
+++ b/bin/cucumber
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path("../spring", __FILE__)
+rescue LoadError
+end
+require 'bundler/setup'
+load Gem.bin_path('cucumber', 'cucumber')
diff --git a/script/rails b/bin/rails
similarity index 79%
rename from script/rails
rename to bin/rails
index f8da2cff..1c894d52 100755
--- a/script/rails
+++ b/bin/rails
@@ -1,4 +1,8 @@
#!/usr/bin/env ruby
+begin
+ load File.expand_path("../spring", __FILE__)
+rescue LoadError
+end
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
diff --git a/bin/rake b/bin/rake
new file mode 100755
index 00000000..0fb4e07e
--- /dev/null
+++ b/bin/rake
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path("../spring", __FILE__)
+rescue LoadError
+end
+require 'bundler/setup'
+load Gem.bin_path('rake', 'rake')
diff --git a/bin/spring b/bin/spring
new file mode 100755
index 00000000..253ec37c
--- /dev/null
+++ b/bin/spring
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast
+# It gets overwritten when you run the `spring binstub` command
+
+unless defined?(Spring)
+ require "rubygems"
+ require "bundler"
+
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
+ ENV["GEM_HOME"] = ""
+ Gem.paths = ENV
+
+ gem "spring", match[1]
+ require "spring/binstub"
+ end
+end
diff --git a/config/application.rb b/config/application.rb
index 50084086..b3ec5442 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -4,7 +4,7 @@ require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
-Bundler.require(:default, Rails.env)
+Bundler.require(*Rails.groups)
require 'yaml'
SITE_CONFIG = YAML.load_file(File.join(File.dirname(__FILE__), 'site.yml'))
diff --git a/config/boot.rb b/config/boot.rb
index 35967366..5e5f0c1f 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,4 +1,4 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
diff --git a/config/environment.rb b/config/environment.rb
index 4a07573b..ee8d90dc 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,5 +1,5 @@
-# Load the rails application.
+# Load the Rails application.
require File.expand_path('../application', __FILE__)
-# Initialize the rails application.
-Tracksapp::Application.initialize!
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 164a7542..6df6a80f 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,5 +1,5 @@
-Tracksapp::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
diff --git a/config/environments/production.rb b/config/environments/production.rb
index e7559e97..8f5552e9 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,4 +1,4 @@
-Tracksapp::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 76f8aee0..8e4c34fc 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,4 +1,4 @@
-Tracksapp::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 29d542cf..dff12be6 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Tracksapp::Application.config.session_store :cookie_store, key: '_tracksapp_session'
+Rails.application.config.session_store :cookie_store, key: '_tracksapp_session'
diff --git a/config/routes.rb b/config/routes.rb
index 6b786ff9..a27bdb4e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,4 @@
-Tracksapp::Application.routes.draw do
+Rails.application.routes.draw do
mount Tolk::Engine => '/tolk', :as => 'tolk' if Rails.env=='development'
root :to => 'todos#index'
diff --git a/db/schema.rb b/db/schema.rb
index 063744e8..96516f59 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -15,7 +15,7 @@ ActiveRecord::Schema.define(version: 20130227205845) do
create_table "contexts", force: true do |t|
t.string "name", null: false
- t.integer "position", default: 0
+ t.integer "position"
t.integer "user_id", default: 1
t.datetime "created_at"
t.datetime "updated_at"
@@ -85,11 +85,11 @@ ActiveRecord::Schema.define(version: 20130227205845) do
add_index "preferences", ["user_id"], name: "index_preferences_on_user_id", using: :btree
create_table "projects", force: true do |t|
- t.string "name", null: false
- t.integer "position", default: 0
- t.integer "user_id", default: 1
- t.text "description", limit: 16777215
- t.string "state", limit: 20, null: false
+ t.string "name", null: false
+ t.integer "position"
+ t.integer "user_id", default: 1
+ t.text "description"
+ t.string "state", limit: 20, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "default_context_id"
@@ -104,17 +104,17 @@ ActiveRecord::Schema.define(version: 20130227205845) do
add_index "projects", ["user_id"], name: "index_projects_on_user_id", using: :btree
create_table "recurring_todos", force: true do |t|
- t.integer "user_id", default: 1
- t.integer "context_id", null: false
+ t.integer "user_id", default: 1
+ t.integer "context_id", null: false
t.integer "project_id"
- t.string "description", null: false
- t.text "notes", limit: 16777215
- t.string "state", limit: 20, null: false
+ t.string "description", null: false
+ t.text "notes"
+ t.string "state", limit: 20, null: false
t.datetime "start_from"
t.string "ends_on"
t.datetime "end_date"
t.integer "number_of_occurences"
- t.integer "occurences_count", default: 0
+ t.integer "occurences_count", default: 0
t.string "target"
t.integer "show_from_delta"
t.string "recurring_period"
@@ -123,7 +123,7 @@ ActiveRecord::Schema.define(version: 20130227205845) do
t.integer "every_other2"
t.integer "every_other3"
t.string "every_day"
- t.boolean "only_work_days", default: false
+ t.boolean "only_work_days", default: false
t.integer "every_count"
t.integer "weekday"
t.datetime "completed_at"
@@ -141,7 +141,7 @@ ActiveRecord::Schema.define(version: 20130227205845) do
t.datetime "updated_at"
end
- add_index "sessions", ["session_id"], name: "sessions_session_id_index", using: :btree
+ add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
create_table "taggings", force: true do |t|
t.integer "taggable_id"
@@ -162,19 +162,19 @@ ActiveRecord::Schema.define(version: 20130227205845) do
add_index "tags", ["name"], name: "index_tags_on_name", using: :btree
create_table "todos", force: true do |t|
- t.integer "context_id", null: false
+ t.integer "context_id", null: false
t.integer "project_id"
- t.string "description", null: false
- t.text "notes", limit: 16777215
+ t.string "description", null: false
+ t.text "notes"
t.datetime "created_at"
t.datetime "due"
t.datetime "completed_at"
- t.integer "user_id", default: 1
+ t.integer "user_id", default: 1
t.datetime "show_from"
- t.string "state", limit: 20, null: false
+ t.string "state", limit: 20, null: false
t.integer "recurring_todo_id"
t.datetime "updated_at"
- t.text "rendered_notes", limit: 16777215
+ t.text "rendered_notes"
end
add_index "todos", ["context_id"], name: "index_todos_on_context_id", using: :btree
@@ -212,7 +212,7 @@ ActiveRecord::Schema.define(version: 20130227205845) do
create_table "users", force: true do |t|
t.string "login", limit: 80, null: false
- t.string "crypted_password", limit: 60
+ t.string "crypted_password", limit: 60, null: false
t.string "token"
t.boolean "is_admin", default: false, null: false
t.string "first_name"
diff --git a/db/tracks-blank.sqlite3.db b/db/tracks-blank.sqlite3.db
deleted file mode 100644
index aa3388a9..00000000
Binary files a/db/tracks-blank.sqlite3.db and /dev/null differ
diff --git a/db/tracks-example.sqlite3.db b/db/tracks-example.sqlite3.db
deleted file mode 100644
index c36b6703..00000000
Binary files a/db/tracks-example.sqlite3.db and /dev/null differ
diff --git a/db/tracks-test.sqlite3.db b/db/tracks-test.sqlite3.db
deleted file mode 100644
index 6abee81b..00000000
Binary files a/db/tracks-test.sqlite3.db and /dev/null differ
diff --git a/doc/CHANGELOG b/doc/CHANGELOG
index 115c35a9..5730b69d 100644
--- a/doc/CHANGELOG
+++ b/doc/CHANGELOG
@@ -3,19 +3,20 @@
* Project homepage: http://getontracks.org/
* Manual: http://getontracks.org/manual/
* Source at GitHub: https://github.com/TracksApp/tracks
-* Assembla space (for bug reports and feature requests): https://www.assembla.com/spaces/tracks-tickets/tickets
+* Bug reports and feature requests: https://github.com/TracksApp/tracks/issues
* Wiki (community contributed information): https://github.com/TracksApp/tracks/wiki
-* Forum (read-only): http://getontracks.org/forums/
* Mailing list: http://groups.google.com/group/TracksApp
* Original developer: bsag (http://www.rousette.org.uk/)
* Contributors: https://github.com/TracksApp/tracks/wiki/Contributors
* Version: 2.3devel
-* Copyright: (cc) 2004-2013 rousette.org.uk.
+* Copyright: (cc) 2004-2014 rousette.org.uk.
* License: GNU GPL
== Version 2.3devel
New and changed features
+* Added new binstubs. The commands `bin/rails` and `bin/rake` take the place of
+ the old `bundle exec rails` and `bundle exec rake`, respectively.
* You can select to group todos on the home page by context or by
project (using the view menu). This also works for tag page, the project page,
the tickler and the context page
diff --git a/doc/installation.textile b/doc/installation.textile
index 0ae21f9e..a0e1f60f 100644
--- a/doc/installation.textile
+++ b/doc/installation.textile
@@ -1,12 +1,34 @@
h1. Installing Tracks
+The following instructions will guide you through the installation of Tracks from source.
-h2. Getting Tracks
+This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see the "upgrade documentation":upgrading.textile.
+Various Tracks users have contributed installation howtos for specific environments. They are "on the wiki":https://github.com/TracksApp/tracks/wiki/Installation-index.
+
+If you are not confident installing Tracks from source using these instructions, there are several alternative options provided by third parties:
+
+* If you'd like to install Tracks on a local machine, try the packaged version offered by "Bitnami":http://bitnami.org/stack/tracks -- it runs on Windows, Mac OS X and Linux.
+* If you'd like to run Tracks within a dedicated virtual machine, "JumpBox":http://jumpbox.com/app/tracks provides preconfigured virtual machine images.
+* Several providers offer individual Tracks user accounts. A list of these providers can be found "on the wiki":https://github.com/TracksApp/tracks/wiki/Tracks-hosting.
+
+(Please note that these third-party options may use older versions of Tracks.)
+
+
+h2. Prerequisites
+
+Tracks has a few software requirements that must be satisfied before installation:
+
+# *Ruby*. Tracks requires Ruby 1.9.2 or greater.
+# *Bundler*. Tracks requires a recent version of "Bundler":http://bundler.io to handle the installation of dependencies. Bundler is typically installed by running @gem install bundler@.
+# *Database*. Tracks is tested on "MySQL":http://www.mysql.com/, but "SQLite":http://www.sqlite.org/ and "PostgreSQL":http://www.postgresql.org/ can also be used. Of the three, SQLite requires the least configuration. Whatever your choice, the appropriate database software must be installed.
+
+
+h2. Get Tracks
There are two methods of downloading Tracks:
-# (Recommended for most people) Download the "zipped package":https://github.com/TracksApp/tracks/archive/v2.2.zip for the latest stable release (2.2) and unzip in your preferred location (e.g. @~/Sites@ for Mac OS X users).
+# (Recommended for most people) Download the "zipped package":https://github.com/TracksApp/tracks/archive/v2.2.2.zip for the latest stable release (2.2.2) and unzip in your preferred location (e.g. @~/Sites@ for Mac OS X users).
# If you want to live on the edge, you can get the latest development version from GitHub using git (bear in mind that this may be less stable than the released versions):
bc. cd ~/Sites
@@ -14,120 +36,65 @@ git clone https://github.com/TracksApp/tracks.git
cd tracks
-h3. Easy installation options
+h2. Set up the database
+_This section only applies if you will be using Tracks with a MySQL database._
-There are a few easy options if you are not confident about installing Tracks from source using these instructions. If you'd like to install Tracks on a local machine, try "BitNami":http://bitnami.org/stack/tracks -- it runs on Windows, Mac OS X and Linux. But they also support preconfigured virtual machines, including Amazon machine images.
-
-Alternatively, you could try "JumpBox":http://jumpbox.com/app/tracks, who provide a JumpBox for Tracks. JumpBoxes are pre-built, pre-configured virtual applications which run in a range of "Virtualization software applications":http://www.jumpbox.com/supported-virtualization-software. You just download the JumpBox (free), then open the file with your Virtualization software. Once the JumpBox has booted, it will give you a URL which you can visit in a browser. The software will then guide you through setting up an account. If you'd like to try out the JumpBox without installing it, you can use the 'Trial This JumpBox' button on the web site, which will let you play around with it to test it out. Furthermore, there is a free public AMI available for Amazon EC2. Just use any EC2 client and search for Tracks. This works in exactly the same way as the downloaded JumpBox you can easily migrate from a downloaded installation to an EC2 instance or back using the backup system of the JumpBox.
-
-Several third parties provide Tracks hosting as a service. A list of these providers can be found "on the wiki":https://github.com/TracksApp/tracks/wiki/Tracks-hosting. Please note that they may run older versions of Tracks.
-
-
-h3. Requirements
-
-
-The Tracks interface is accessed through a web browser, so you need to run a webserver to serve the Tracks pages up to you. This isn't as daunting as it sounds, however: Tracks ships with a built-in web server called Mongrel which you can run on your own computer to serve the Tracks application locally. If you want to be able to access Tracks from any computer connected to the Internet, then you need to install Tracks on a publicly accessible server, and you will probably be better off using a more robust web server such as "Apache":http://www.apache.org/ (using "modrails":http://www.modrails.com/) or "Lighttpd":http://www.lighttpd.net/ to serve the pages, particularly if it will be used by many people.
-
-Tracks stores its data in a database, and you can either use SQLite3, MySQL or PostgreSQL. SQLite3 is the best choice for a single user (or a small number of users) on a local installation, while MySQL or PostgreSQL is better for multiple users on a remote installation.
-
-
-h3. What is included with the Tracks package?
-
-# Tracks itself
-# An empty SQLite3 database, set up with the correct database schema
-
-
-h3. What you need to install
-
-If you don't want to (or can't) use one of the all in one installations, you'll need to install a few things, depending on your platform and your needs.
-
-# *Ruby*. Tracks requires either Ruby 1.8.7 or Ruby 1.9.x. Ruby 1.9.x is the recommended version. Please note that support for ruby 1.8.7 will be dropped after this release!
-# *RubyGems*. Tracks was tested on version 1.8.24. You may upgrade using @gem update --system@. The gems needed by Rails to interact with the database have to be compiled on the platform on which they will be run, so we cannot include them with the Tracks package, unlike some other gems. So you will need to "download":http://rubyforge.org/frs/?group_id=126 and install RubyGems (run @ruby setup.rb@ after extracting the package). If you use Linux, rubygems may be available throught your packaging system. Mac OS X users already have RubyGems and the SQLite3 gem already installed on their systems. Once installed you can use RubyGems to install the gems you need for your database. Run @bundle install --without development test@ from the directory you installed Tracks in. This will install all needed gems, including those for MySQL and Sqlite3. If you do not want one of them, you can comment it out in your @Gemfile@ which can be found in the root of the Tracks installation.
-# *Database*. The easiest option is to use SQLite3, as the database is included in the package. You may need to install it first for your platform (see "sqlite.org":http://sqlite.org/download.html for downloads and installation instructions). If you want to use MySQL, download and install a package for your platform from "MySQL.com":http://dev.mysql.com/downloads/mysql/5.0.html. The basic steps for Postgresql should be similar to those for MySQL, but they will not be discussed further here.
-
-
-Various Tracks users have contributed installation howtos for specific setups. They are "on the wiki":https://github.com/TracksApp/tracks/wiki/Installation-index.
-
-
-h2. Installation
-
-This description is intended for people installing Tracks from scratch. If you would like to upgrade an existing installation, please see the "upgrade documentation":upgrading.textile.
-
-# Unzip tracks and install in a directory
-# Decide on a database to use
-## SQLite3 - change database.yml to point to SQLite3 database. Make sure you add the complete path to the database. Remove the @mysql2@ gem from the Gemfile
-## MySQL - create new MySQL db and grant all privileges
-# Install the necessary prerequisites using Bundler
-# Configure some variables
-# Populate the database with the Tracks schema
-# Start the server
-# Visit Tracks in a browser
-# Customise Tracks
-
-
-h3. Unzip Tracks and install
-
-Unzip the package and move Tracks into the directory you want to run it from. For example, for Mac OS X users, @~/Sites@ is a good choice.
-
-
-h3. Decide on a database
-
-Before you go any further, you need to decide which database you will use. See the 'What you need to install' section for details on installing the required components for you choice of database.
-
-# *SQLite3*. All you need to do is make sure that you point Tracks to the included SQLite3 database in @/db@ in the next step, 'Configure variables'.
-# *MySQL*. Once you have MySQL installed, you need to create a database and database-user to use with Tracks. For this, you can use MySQL Administrator or go into a terminal and issue the following commands:
+You need to create a database and database-user to use with Tracks. For this, you can use MySQL Administrator or go into a terminal and issue the following commands:
bc. mysql -uroot -p
mysql> CREATE DATABASE tracks;
mysql> GRANT ALL PRIVILEGES ON tracks.* TO yourmysqluser@localhost \
IDENTIFIED BY 'password-goes-here' WITH GRANT OPTION;
-h3. Install the necessary prerequisites using Bundler
-Tracks makes use of several other Ruby libraries (known as 'gems') to provide additional functionality. The Bundler tool makes it easy for the gems that Tracks needs to be installed.
+h2. Install dependencies
+
+Tracks is built upon a number of Ruby libraries (known as 'gems'). The Bundler tool makes it easy to install all the gems that Tracks needs, and ensures that they are all the correct versions.
-# Make sure you have bundler on your system already. It can be installed by running @gem install bundler@
# Run the command @bundle install --without development test@ in the directory that you unzipped your Tracks download to.
# Wait for Bundler to finish installing the necessary gems that Tracks needs. This can take some time depending on the speed of your internet connection and the speed of the system you're installing Tracks on.
-h3. Configure variables
-# If you downloaded Tracks via GitHub, you need to duplicate the files @database.yml.tmpl@ and @site.yml.tmpl@ and remove the @*.tmpl@ extension from the duplicates. Once you've made those copies, edit the files as described in steps 2 and 3.
-# Open the file @/config/database.yml@ and edit the @production:@ section with the details of your database. If you are using MySQL the @adapter:@ line should read @adapter: mysql2@, @host: localhost@ (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: @adapter: sqlite3@ and @database: db/tracks-blank.db@.
-# Open the file @/config/site.yml@, and read through the settings to make sure that they suit your setup. In most cases, all you need to change are the @salt: "change-me"@ line (change the string "change-me" to some other string of your choice), the administrator email address (@admin_email@), and the time zone setting. For the time zone setting you can use the command @bundle exec rake time:zones:local@ to see all available timezones on your machine
+h2. Configure variables
+
+# In the @config@ folder, copy the files @database.yml.tmpl@ and @site.yml.tmpl@ to @database.yml@ and @site.yml@, respectively.
+# Open the file @config/database.yml@ and edit the @production:@ section with the details of your database. If you are using MySQL the @adapter:@ line should read @adapter: mysql2@, @host: localhost@ (in the majority of cases), and your username and password should match those you assigned when you created the database. If you are using SQLite3, you should have only two lines under the production section: @adapter: sqlite3@ and @database: db/tracks.db@.
+# Open the file @config/site.yml@, and read through the settings to make sure that they suit your setup. In most cases, all you need to change are the @salt: "change-me"@ line (change the string "change-me" to some other string of your choice), the administrator email address (@admin_email@), and the time zone setting. For the time zone setting you can use the command @bin/rake time:zones:local@ to see all available timezones on your machine
# If you are using Windows, you may need to check the 'shebang' lines (@#!/usr/bin/env ruby@) of the @/public/dispatch.*@ files and all the files in the @/script@ directory. They are set to @#!/usr/bin/env ruby@ by default. This should work for all Unix based setups (Linux or Mac OS X), but Windows users will probably have to change it to something like @#c:/ruby/bin/ruby@ to point to the Ruby binary on your system.
# If you intend to deploy Tracks with the built in webserver called WEBrick, you'll need to change @config.serve_static_assets@ to @true@ in @config/environments/production.rb@ in order for the images, stylesheets, and javascript files to be served correctly.
-h3. Populate your database with the Tracks schema
+h2. Populate your database with the Tracks schema
Open a terminal and change into the root of your Tracks directory. Enter the following command:
-bc. bundle exec rake db:migrate RAILS_ENV=production
+bc. bin/rake db:migrate RAILS_ENV=production
-This will update your database with the required schema for Tracks. If you are using SQLite3, it is not strictly necessary, because the SQLite3 database included with Tracks already has the schema included in it, but it should not do any harm to run the command (nothing will happen if it is up to date).
+This will set up your database with the required structure to hold Tracks' data.
-h3. Precompile assets
+
+h2. Precompile assets
Static assets (images, stylesheets, and javascript) need to be compiled in order for them to work correctly with the new asset pipeline feature in Rails. Precompiling your assets is as simple as running the following command while inside the Tracks root directory:
-bc. bundle exec rake assets:precompile
+bc. bin/rake assets:precompile
-h3. Start the server
+
+h2. Start the server
While still in the Terminal inside the Tracks root directory, issue the following command:
-bc. bundle exec rails server -e production
+bc. bin/rails server -e production
-If all goes well, you should see some text informing you that the WEBrick server is running: @=> Rails application starting in production on http://0.0.0.0:3000@. If you are already running other services on port 3000, you need to select a different port when running the server, using the @-p@ option. You can stop the server again by the key combination Ctrl-C.
+If all goes well, you should see some text informing you that the WEBrick server is running: @=> Rails application starting in production on http://0.0.0.0:3000@. If you are already running other services on port 3000, you need to select a different port when running the server, using the @-p@ option.
-h3. Visit Tracks in a browser
+h2. Visit Tracks in a browser
Visit @http://0.0.0.0:3000/signup@ in a browser (or whatever URL and port was reported when you started the server in the step above) and chose a user name and password for admin user. Once logged in as admin, you can add other (ordinary level) users. If you need to access Tracks from a mobile/cellular phone browser, visit @http://yourdomain.com/mobile/@. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
-h3. Customise Tracks
+h2. Customise Tracks
Once logged in, add some Contexts and Projects, and then go ahead and add your actions. You might also want to visit the Preferences page to edit various settings to your liking. Have fun!
diff --git a/doc/upgrading.textile b/doc/upgrading.textile
index ba19f75d..2c71375e 100644
--- a/doc/upgrading.textile
+++ b/doc/upgrading.textile
@@ -9,9 +9,9 @@ That said. To upgrade:
# Install Tracks 2.3devel in a new directory. Or you can create a separate installation of 2.3 for testing purposes.
# Copy over the configuration from your previous Tracks installation. If using SQLite3, copy the old database into the new Tracks 2.3devel directory.
# Check that you have all dependencies installed: @bundle install --without development test@ Or leave out the @--without development test@ part if you intent to test or develop on this tree.
-# Run @bundle exec rake db:migrate RAILS_ENV=production@ to update your old database to the new schema. This is the point of no return. Make sure you have backups!
-# Precompile your static assets (css, javascript, etc.) by running @bundle exec rake assets:precompile@.
-# Run @bundle exec rails server -e production@ inside your Tracks 2.3devel directory to start up Tracks. Or use @-e development@ if you intent to try your changes and get more log info.
+# Run @bin/rake db:migrate RAILS_ENV=production@ to update your old database to the new schema. This is the point of no return. Make sure you have backups!
+# Precompile your static assets (css, javascript, etc.) by running @bin/rake assets:precompile@.
+# Run @bin/rails server -e production@ inside your Tracks 2.3devel directory to start up Tracks. Or use @-e development@ if you intent to try your changes and get more log info.
Please note that if you intend to use Tracks with the built in webserver called WEBrick for production, you'll need to change @config.serve_static_assets@ to @true@ in @config/environments/production.rb@ in order for the images, stylesheets, and javascript files to be served correctly.
diff --git a/features/add_todo_from_cli.feature b/features/add_todo_from_cli.feature
index ebf05a7b..11044714 100644
--- a/features/add_todo_from_cli.feature
+++ b/features/add_todo_from_cli.feature
@@ -15,7 +15,7 @@ Feature: Add a todo to Tracks on console
And I have a context called "Context A"
And I have a project called "Project A"
- @javascript @aruba
+ @javascript @aruba @wip
Scenario: Create a single todo
Given a console input that looks like
"""
@@ -24,7 +24,7 @@ Feature: Add a todo to Tracks on console
When I execute the add-todo script
Then I should have 1 todo in project "Project A"
- @javascript @aruba
+ @javascript @aruba @wip
Scenario: Create multiple todos
Given a console input that looks like
"""
diff --git a/features/edit_a_todo.feature b/features/edit_a_todo.feature
index fb60b9aa..c1cf9391 100644
--- a/features/edit_a_todo.feature
+++ b/features/edit_a_todo.feature
@@ -236,6 +236,13 @@ Feature: Edit a next action from every page
When I go to the "project one" project
Then I should see the todo "todo 1"
+ @javascript
+ Scenario: I can give a todo without a project a blank project name
+ Given I have a todo "todo 1" in the context "@pc"
+ When I go to the home page
+ And I edit the project of "todo 1" to ""
+ Then I should see the todo "todo 1"
+
@javascript
Scenario: I can edit a todo to move it to the tickler
When I go to the home page
diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb
index c75838ae..40aef4f4 100644
--- a/features/step_definitions/container_steps.rb
+++ b/features/step_definitions/container_steps.rb
@@ -1,12 +1,12 @@
When(/^I collapse the context container of "([^"]*)"$/) do |context_name|
toggle = page.find(:xpath, toggle_context_container_xpath(find_context(context_name)))
- toggle.should be_visible
+ expect(toggle).to be_visible
toggle.click
end
When(/^I collapse the project container of "(.*?)"$/) do |project_name|
toggle = page.find(:xpath, toggle_project_container_xpath(find_project(project_name)))
- toggle.should be_visible
+ expect(toggle).to be_visible
toggle.click
end
@@ -107,7 +107,7 @@ end
Then /^I should see "([^"]*)" in the due next month container$/ do |todo_description|
within "div#due_after_this_month_container" do
- page.should have_css("div#line_todo_#{find_todo(todo_description).id}")
+ expect(page).to have_css("div#line_todo_#{find_todo(todo_description).id}")
end
end
@@ -148,7 +148,7 @@ Then /^I should (see|not see) empty message for (done today|done this week|done
css = "div#deferred_pending_container-empty-d" if state == "deferred todos"
elem = find(css)
- elem.should_not be_nil
+ expect(elem).to_not be_nil
check_elem_visibility(visible, elem)
end
\ No newline at end of file
diff --git a/features/step_definitions/context_list_steps.rb b/features/step_definitions/context_list_steps.rb
index 3bddc8b1..83beaba6 100644
--- a/features/step_definitions/context_list_steps.rb
+++ b/features/step_definitions/context_list_steps.rb
@@ -4,10 +4,10 @@ When /^I delete the context "([^\"]*)"$/ do |context_name|
handle_js_confirm do
click_link "delete_context_#{context.id}"
end
- get_confirm_text.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!"
+ expect(get_confirm_text).to eq("Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!")
# wait until the context is removed
- page.should_not have_css("a#delete_context_#{context.id}")
+ expect(page).to_not have_css("a#delete_context_#{context.id}")
end
When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
@@ -61,7 +61,7 @@ When /^I edit the state of context "(.*?)" to closed$/ do |context_name|
end
Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low|
- context_list_find_index(context_high).should < context_list_find_index(context_low)
+ expect(context_list_find_index(context_high)).to be < context_list_find_index(context_low)
end
Then(/^I should see that a context named "([^"]*)" (is|is not) present$/) do |context_name, present|
@@ -87,9 +87,9 @@ Then /^the new context form should (be|not be) visible$/ do |visible|
end
Then /^the context list badge for ([^"]*) contexts should show (\d+)$/ do |state_name, count|
- find("span##{state_name}-contexts-count").text.should == count
+ expect(find("span##{state_name}-contexts-count").text).to eq(count)
end
Then /^I should (see|not see) empty message for (active|hidden|closed) contexts$/ do |visible, state|
check_css_visibility(visible, "div##{state}-contexts-empty-nd")
-end
\ No newline at end of file
+end
diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb
index c13ae0d7..6d4719a5 100644
--- a/features/step_definitions/context_steps.rb
+++ b/features/step_definitions/context_steps.rb
@@ -5,7 +5,7 @@ end
Given /^there exists (an active|a hidden|a closed) context called "([^"]*)" for user "([^"]*)"$/ do |state, context_name, login|
user = User.where(:login => login).first
- user.should_not be_nil
+ expect(user).to_not be_nil
context_state = {"an active" => "active", "a hidden" => "hidden", "a closed" => "closed"}[state]
@context = user.contexts.where(:name => context_name, :state => context_state).first_or_create
end
@@ -63,11 +63,11 @@ end
Then /^he should see that a context named "([^\"]*)" (is|is not) present$/ do |context_name, visible|
context = @current_user.contexts.where(:name => context_name).first
if visible == "is"
- context.should_not be_nil
+ expect(context).to_not be_nil
css = "div#context_#{context.id} div.context_description a"
- page.should have_selector(css, :visible => true)
- page.find(:css, css).text.should == context_name
+ expect(page).to have_selector(css, :visible => true)
+ expect(page.find(:css, css).text).to eq(context_name)
else
- page.should_not have_selector("div#context_#{context.id} div.context_description a", :visible => true) if context
+ expect(page).to_not have_selector("div#context_#{context.id} div.context_description a", :visible => true) if context
end
-end
\ No newline at end of file
+end
diff --git a/features/step_definitions/dependencies_steps.rb b/features/step_definitions/dependencies_steps.rb
index f48cfada..c2db3229 100644
--- a/features/step_definitions/dependencies_steps.rb
+++ b/features/step_definitions/dependencies_steps.rb
@@ -18,7 +18,7 @@ end
When /^I expand the dependencies of "([^\"]*)"$/ do |todo_name|
todo = Todo.where(:description=>todo_name).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
expand_img_locator = "//div[@id='line_todo_#{todo.id}']/div/a[@class='show_successors']/img"
page.find(:xpath, expand_img_locator).click
@@ -28,9 +28,9 @@ end
When /^I edit the dependency of "([^"]*)" to add "([^"]*)" as predecessor$/ do |todo_description, predecessor_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
predecessor = @current_user.todos.where(:description => predecessor_description).first
- predecessor.should_not be_nil
+ expect(predecessor).to_not be_nil
open_edit_form_for(todo)
@@ -43,29 +43,29 @@ When /^I edit the dependency of "([^"]*)" to add "([^"]*)" as predecessor$/ do |
page.execute_script %Q{$("#{form_css}").find('input[id$="predecessor_input"]').autocomplete('search')} if Capybara.javascript_driver == :webkit
# wait for auto complete
- page.should have_css("a.ui-state-focus")
+ expect(page).to have_css("a.ui-state-focus")
# click first line
page.find(:css, "ul li a.ui-state-focus").click
# wait for the new dependency to be added to the list
- page.should have_css("li#pred_#{predecessor.id}")
+ expect(page).to have_css("li#pred_#{predecessor.id}")
submit_edit_todo_form(todo)
end
When /^I edit the dependency of "([^"]*)" to remove "([^"]*)" as predecessor$/ do |todo_description, predecessor_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
predecessor = @current_user.todos.where(:description => predecessor_description).first
- predecessor.should_not be_nil
+ expect(predecessor).to_not be_nil
open_edit_form_for(todo)
delete_dep_button = "//form[@id='form_todo_#{todo.id}']//img[@id='delete_dep_#{predecessor.id}']"
page.find(:xpath, delete_dep_button).click
- page.should_not have_xpath(delete_dep_button)
+ expect(page).to_not have_xpath(delete_dep_button)
submit_edit_todo_form(todo)
wait_for_ajax
@@ -74,7 +74,7 @@ end
When /^I edit the dependency of "([^"]*)" to "([^"]*)"$/ do |todo_name, deps|
todo = @dep_todo = @current_user.todos.where(:description => todo_name).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
fill_in "predecessor_list_todo_#{todo.id}", :with => deps
@@ -83,7 +83,7 @@ end
Then /^the successors of "(.*)" should include "(.*)"$/ do |parent_name, child_name|
parent = @current_user.todos.where(:description => parent_name).first
- parent.should_not be_nil
+ expect(parent).to_not be_nil
# wait until the successor is added. TODO: make this not loop indefinitly
wait_until do
@@ -95,7 +95,7 @@ end
Then /^I should see "([^\"]*)" within the dependencies of "([^\"]*)"$/ do |successor_description, todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
# open successors
within "div#line_todo_#{todo.id}" do
@@ -109,14 +109,14 @@ end
Then /^I should not see "([^"]*)" within the dependencies of "([^"]*)"$/ do |successor_description, todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
step "I should not see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\""
end
Then /^I should see that "([^"]*)" does not have dependencies$/ do |todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
dependencies_icon = "//div[@id='line_todo_#{todo.id}']/div/a[@class='show_successors']/img"
- page.should_not have_xpath(dependencies_icon)
+ expect(page).to_not have_xpath(dependencies_icon)
end
\ No newline at end of file
diff --git a/features/step_definitions/feedlist_steps.rb b/features/step_definitions/feedlist_steps.rb
index 39a4a9c2..ffe5160b 100644
--- a/features/step_definitions/feedlist_steps.rb
+++ b/features/step_definitions/feedlist_steps.rb
@@ -7,23 +7,23 @@ Then /^I should see a message that you need a project to get feeds for projects$
end
Then /^I should see feeds for projects$/ do
- page.should have_css("select#feed-projects option[value='#{@current_user.projects.first.id}']")
+ expect(page).to have_css("select#feed-projects option[value='#{@current_user.projects.first.id}']")
end
Then /^I should see feeds for contexts$/ do
- page.should have_css("select#feed-contexts option[value='#{@current_user.contexts.first.id}']")
+ expect(page).to have_css("select#feed-contexts option[value='#{@current_user.contexts.first.id}']")
end
Then /^I should see "([^"]*)" as the selected project$/ do |project_name|
- page.should have_css 'select#feed-projects option[selected="selected"]'
+ expect(page).to have_css('select#feed-projects option[selected="selected"]')
end
Then /^I should see "([^"]*)" as the selected context$/ do |context_name|
- page.should have_css 'select#feed-contexts option[selected="selected"]'
+ expect(page).to have_css('select#feed-contexts option[selected="selected"]')
end
Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type|
wait_for_ajax
xpath= "//div[@id='feeds-for-#{list_type}']//strong"
- name.should == find(:xpath, xpath).text
+ expect(name).to eq(find(:xpath, xpath).text)
end
diff --git a/features/step_definitions/generic_steps.rb b/features/step_definitions/generic_steps.rb
index 98d4f13f..0a4f3d24 100644
--- a/features/step_definitions/generic_steps.rb
+++ b/features/step_definitions/generic_steps.rb
@@ -10,26 +10,21 @@ Given /^I am working on the mobile interface$/ do
@mobile_interface = true
end
-Given /^the date is "(.*?)"$/ do |date|
- # remember to tag the scenario with @reset_time to reset this travel
- Timecop.travel(date)
-end
-
Given(/^I have selected the view for group by (project|context)$/) do |grouping|
@group_view_by = grouping
end
Then /the badge should show (.*)/ do |number|
badge = find("span#badge_count").text.to_i
- badge.should == number.to_i
+ expect(badge).to eq(number.to_i)
end
Then(/^I should see an error flash message saying "([^"]*)"$/) do |message|
xpath = "//div[@id='message_holder']/h4[@id='flash']"
- page.should have_xpath(xpath, :visible => true)
+ expect(page).to have_xpath(xpath, :visible => true)
text = page.find(:xpath, xpath).text
- text.should == message
+ expect(text).to eq(message)
end
Then /^I should see "([^"]*)" $/ do |text|
diff --git a/features/step_definitions/integration_steps.rb b/features/step_definitions/integration_steps.rb
index b9c39c56..bf5fba5c 100644
--- a/features/step_definitions/integration_steps.rb
+++ b/features/step_definitions/integration_steps.rb
@@ -8,13 +8,13 @@ Then /^I should see scripts$/ do
end
Then /^I should see a script "([^\"]*)" for "([^\"]*)"$/ do |script, context_name|
- page.should have_css("##{script}", :visible => true)
+ expect(page).to have_css("##{script}", :visible => true)
context = Context.where(:name => context_name).first
- page.should have_content("#{context.id} (* #{context_name} *)")
+ expect(page).to have_content("#{context.id} (* #{context_name} *)")
# make sure the text is found within the textarea
script_source = page.find(:xpath, "//textarea[@id='#{script}']").text
- script_source.should =~ /#{context.id} \(\* #{context_name} \*\)/
+ expect(script_source).to match(/#{context.id} \(\* #{context_name} \*\)/)
end
diff --git a/features/step_definitions/note_steps.rb b/features/step_definitions/note_steps.rb
index eebd1e4e..586a1382 100644
--- a/features/step_definitions/note_steps.rb
+++ b/features/step_definitions/note_steps.rb
@@ -10,9 +10,9 @@ When /^I delete the first note$/ do
handle_js_confirm do
click_link "delete_note_#{id}"
end
- get_confirm_text.should == "Are you sure that you want to delete the note '#{id}'?"
+ expect(get_confirm_text).to eq("Are you sure that you want to delete the note '#{id}'?")
- page.should_not have_css("a#delete_note_#{id}")
+ expect(page).to_not have_css("a#delete_note_#{id}")
end
When /^I click the icon next to the note$/ do
@@ -32,7 +32,7 @@ end
When(/^I toggle the note of "([^"]*)"$/) do |todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath = "//div[@id='line_todo_#{todo.id}']/div/a/img"
page.find(:xpath, xpath).click
@@ -52,7 +52,7 @@ Then /^(.*) notes should be visible$/ do |number|
# count number of project_notes
count = 0
page.all("div.project_notes").each { |node| count += 1 }
- count.should == number.to_i
+ expect(count).to eq(number.to_i)
end
Then /^I should see note "([^\"]*)" on the "([^\"]*)" project page$/ do |note, project|
@@ -71,7 +71,7 @@ Then /^the first note should disappear$/ do
id = title.split(' ').last
note = "div#note_#{id}"
- page.should_not have_css(note, :visible=>true)
+ expect(page).to_not have_css(note, :visible=>true)
end
Then /^I should see the note text$/ do
@@ -79,9 +79,9 @@ Then /^I should see the note text$/ do
end
Then /^I should not see the note "([^"]*)"$/ do |note_content|
- page.should_not have_selector("div", :text => note_content, :visible => true)
+ expect(page).to_not have_selector("div", :text => note_content, :visible => true)
end
Then /^I should see the note "([^"]*)"$/ do |note_content|
- page.all("div", :text => note_content).first.should be_visible
-end
\ No newline at end of file
+ expect(page.all("div", :text => note_content).first).to be_visible
+end
diff --git a/features/step_definitions/project_list_steps.rb b/features/step_definitions/project_list_steps.rb
index 22ca8c23..6f8772d0 100644
--- a/features/step_definitions/project_list_steps.rb
+++ b/features/step_definitions/project_list_steps.rb
@@ -1,11 +1,11 @@
When /^I delete project "([^"]*)"$/ do |project_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
handle_js_confirm do
click_link "delete_project_#{project.id}"
end
- get_confirm_text.should == "Are you sure that you want to delete the project '#{project_name}'?"
+ expect(get_confirm_text).to eq("Are you sure that you want to delete the project '#{project_name}'?")
wait_until do
!page.has_css?("a#delete_project_#{project.id}")
@@ -40,7 +40,7 @@ When /^I sort the active list alphabetically$/ do
end
wait_for_ajax
end
- get_confirm_text.should == "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order."
+ expect(get_confirm_text).to eq("Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order.")
end
When /^I sort the active list by number of tasks$/ do
@@ -50,7 +50,7 @@ When /^I sort the active list by number of tasks$/ do
end
wait_for_ajax
end
- get_confirm_text.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order."
+ expect(get_confirm_text).to eq("Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order.")
end
Then /^I should see that a project named "([^"]*)" is not present$/ do |project_name|
@@ -75,34 +75,34 @@ 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
+ expect(project).to_not be_nil
project_xpath = "//div[@id='project_#{project.id}']"
- page.should_not have_xpath(project_xpath)
+ expect(page).to_not have_xpath(project_xpath)
end
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)
+ expect(project_list_find_index(project_high)).to be < project_list_find_index(project_low)
end
Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
list_id = @source_view=="review" ? "list-#{state}-projects" : "list-#{state_name}-projects-container"
xpath = "//div[@id='#{list_id}']//div[@id='project_#{project.id}']"
- page.should_not have_xpath(xpath)
+ expect(page).to_not have_xpath(xpath)
end
Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
list_id = @source_view=="review" ? "list-#{state_name}-projects" : "list-#{state_name}-projects-container"
xpath = "//div[@id='#{list_id}']//div[@id='project_#{project.id}']"
- page.should have_xpath(xpath)
+ expect(page).to have_xpath(xpath)
end
Then /^I see the project "([^"]*)" in the "([^"]*)" list$/ do |project_name, state_name|
@@ -110,27 +110,27 @@ Then /^I see the project "([^"]*)" in the "([^"]*)" list$/ do |project_name, sta
end
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
- page.find(:xpath, "//span[@id='#{state_name}-projects-count']").text.should == count
+ expect(page.find(:xpath, "//span[@id='#{state_name}-projects-count']").text).to eq(count)
end
Then /^the new project form should be visible$/ do
- page.should have_css("div#project_new", :visible => true)
+ expect(page).to have_css("div#project_new", :visible => true)
end
Then /^the new project form should not be visible$/ do
- page.should_not have_css("div#project_new", :visible => true)
+ expect(page).to_not have_css("div#project_new", :visible => true)
end
Then /^the project "([^"]*)" should have (\d+) actions listed$/ do |project_name, count|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
- page.find(:xpath, xpath).text.should == "#{project.name} (#{count} actions)"
+ expect(page.find(:xpath, xpath).text).to eq("#{project.name} (#{count} actions)")
end
Then /^the project "([^"]*)" should have (\d+) deferred actions listed$/ do |project_name, deferred|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
- page.find(:xpath, xpath).text.should == "#{project.name} (#{deferred} deferred actions)"
-end
\ No newline at end of file
+ expect(page.find(:xpath, xpath).text).to eq("#{project.name} (#{deferred} deferred actions)")
+end
diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb
index 43b782df..f7ce8814 100644
--- a/features/step_definitions/project_steps.rb
+++ b/features/step_definitions/project_steps.rb
@@ -42,7 +42,7 @@ end
Given /^there exists a project (?:|called )"([^"]*)" for user "([^"]*)"$/ do |project_name, user_name|
user = User.where(:login => user_name).first
- user.should_not be_nil
+ expect(user).to_not be_nil
@project = user.projects.create!(:name => project_name)
# acts_as_list adds at top by default, but that is counter-intuitive when reading scenario's, so reverse this
@project.move_to_bottom
@@ -73,7 +73,7 @@ Given /^I have a (completed|hidden) project called "([^"]*)"$/ do |state, projec
step "I have a project called \"#{project_name}\""
@project.send(state=="completed" ? "complete!" : "hide!")
@project.reload
- assert @project.send(state=="completed" ? "completed?" : "hidden?")
+ expect(@project.send(state=="completed" ? "completed?" : "hidden?")).to be true
end
Given /^I have (\d+) completed projects$/ do |number_of_projects|
@@ -102,7 +102,7 @@ end
Given /^the default tags for "(.*?)" are "(.*?)"$/ do |project_name, default_tags|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
project.default_tags = default_tags
project.save!
@@ -110,12 +110,12 @@ end
When /^I open the project edit form$/ do
click_link "link_edit_project_#{@project.id}"
- page.should have_css("button#submit_project_#{@project.id}", :visible => true)
+ expect(page).to have_css("button#submit_project_#{@project.id}", :visible => true)
end
When /^I cancel the project edit form$/ do
click_link "cancel_project_#{@project.id}"
- page.should_not have_css("submit_project_#{@project.id}")
+ expect(page).to_not have_css("submit_project_#{@project.id}")
wait_for_animations_to_end
end
@@ -147,13 +147,13 @@ end
When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
@project = @current_user.projects.where(:name => project_current_name).first
- @project.should_not be_nil
+ expect(@project).to_not be_nil
step "I edit the project name to \"#{project_new_name}\""
end
When /^I try to edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
@project = @current_user.projects.where(:name => project_current_name).first
- @project.should_not be_nil
+ expect(@project).to_not be_nil
step "I try to edit the project name to \"#{project_new_name}\""
end
@@ -168,14 +168,14 @@ When /^I click to edit the project name in place$/ do
end
When /^I edit the project settings$/ do
- @project.should_not be_nil
+ expect(@project).to_not be_nil
click_link "link_edit_project_#{@project.id}"
- page.should have_xpath("//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']")
+ expect(page).to have_xpath("//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']")
end
When /^I close the project settings$/ do
- @project.should_not be_nil
+ expect(@project).to_not be_nil
click_link "Cancel"
wait_for_ajax
wait_for_animations_to_end
@@ -183,7 +183,7 @@ end
When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
edit_project_settings(project) do
choose "project_state_#{state_name}"
@@ -192,7 +192,7 @@ end
When /^I edit project "([^"]*)" and mark the project as reviewed$/ do |project_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
open_project_edit_form(project)
click_link "reviewed_project_#{project.id}"
@@ -207,11 +207,11 @@ When /^I add a note "([^"]*)" to the project$/ do |note_body|
submit_button = "div.widgets button#submit_note"
click_link "Add a note"
- page.should have_css submit_button
+ expect(page).to have_css submit_button
fill_in "note[body]", :with => note_body
elem = find(submit_button)
- elem.should_not be_nil
+ expect(elem).to_not be_nil
elem.click
wait_until do
@@ -221,9 +221,9 @@ When /^I add a note "([^"]*)" to the project$/ do |note_body|
end
When /^I click on the first note icon$/ do
- @project.should_not be_nil
+ expect(@project).to_not be_nil
@note = @project.notes.first # assume first note is also first on screen
- @note.should_not be_nil
+ expect(@note).to_not be_nil
click_link "link_note_#{@note.id}"
end
@@ -242,44 +242,44 @@ end
Then /^I should be able to change the project name in place$/ do
# Note that this is not changing the project name
- page.should have_css("span#project_name>form>input")
+ expect(page).to have_css("span#project_name>form>input")
page.find("span#project_name > form > button[type=cancel]").click
- page.should_not have_css("span#project_name>form>input")
+ expect(page).to_not have_css("span#project_name>form>input")
end
Then /^I should not be able to change the project name in place$/ do
step "I click to edit the project name in place"
- page.should_not have_xpath("//span[@id='project_name']/form/input")
+ expect(page).to_not have_xpath("//span[@id='project_name']/form/input")
end
Then /^the form for adding a note should not be visible$/ do
- page.should_not have_css("edit_form_note")
+ expect(page).to_not have_css("edit_form_note")
end
Then /^I should go to that note page$/ do
current_path = URI.parse(current_url).path
note_path = note_path(@note)
- current_path.should == note_path
+ expect(current_path).to eq(note_path)
end
Then /^I should see one note in the project$/ do
- page.should have_xpath("//div[@class='note_wrapper']")
+ expect(page).to have_xpath("//div[@class='note_wrapper']")
end
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |text_in_bold|
xpath="//div[@class='project_description']/p/strong"
- page.should have_xpath(xpath)
+ expect(page).to have_xpath(xpath)
bold_text = page.find(:xpath, xpath).text
- bold_text.should =~ /#{text_in_bold}/
+ expect(bold_text).to match(/#{text_in_bold}/)
end
Then /^I should see the italic text "([^\"]*)" in the project description$/ do |text_in_italic|
xpath="//div[@class='project_description']/p/em"
- page.should have_xpath(xpath)
+ expect(page).to have_xpath(xpath)
italic_text = page.find(:xpath, xpath).text
- italic_text.should =~ /#{text_in_italic}/
+ expect(italic_text).to match(/#{text_in_italic}/)
end
Then /^the project title should be "(.*)"$/ do |title|
@@ -295,24 +295,24 @@ end
Then /^I should (see|not see) the default project settings$/ do |visible|
default_settings = "This project is active with no default context and with no default tags"
- page.should have_css("div.project_settings")
+ expect(page).to have_css("div.project_settings")
elem = page.find("div.project_settings")
if visible == "see"
- elem.should be_visible
- elem.text.should =~ /#{default_settings}/
+ expect(elem).to be_visible
+ expect(elem.text).to match(/#{default_settings}/)
else
- elem.should_not be_visible
+ expect(elem).to_not be_visible
end
end
Then /^I should have a project called "([^"]*)"$/ do |project_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
end
Then /^I should have (\d+) todo in project "([^"]*)"$/ do |todo_count, project_name|
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
- project.todos.count.should == todo_count.to_i
+ expect(project).to_not be_nil
+ expect(project.todos.count).to eq(todo_count.to_i)
end
diff --git a/features/step_definitions/recurring_todo_steps.rb b/features/step_definitions/recurring_todo_steps.rb
index 44e76cea..a417352b 100644
--- a/features/step_definitions/recurring_todo_steps.rb
+++ b/features/step_definitions/recurring_todo_steps.rb
@@ -14,7 +14,7 @@ Given /^I have a repeat pattern called "([^"]*)"$/ do |pattern_name|
:created_at => Time.now - 1.day,
:completed_at => nil
)
- @recurring_todo.completed?.should be_false
+ expect(@recurring_todo.completed?).to be false
@todo = @current_user.todos.create!(
:description => pattern_name,
:context_id => context.id,
@@ -24,7 +24,7 @@ end
Given /^I have a completed repeat pattern "([^"]*)"$/ do |pattern_name|
step "I have a repeat pattern called \"#{pattern_name}\""
@recurring_todo.toggle_completion!
- @recurring_todo.completed?.should be_true
+ expect(@recurring_todo.completed?).to be true
end
Given /^I have (\d+) completed repeat patterns$/ do |number_of_patterns|
@@ -39,39 +39,39 @@ end
When /^I edit the name of the pattern "([^\"]*)" to "([^\"]*)"$/ do |pattern_name, new_name|
pattern = @current_user.recurring_todos.where(:description => pattern_name).first
- pattern.should_not be_nil
+ expect(pattern).to_not be_nil
click_link "link_edit_recurring_todo_#{pattern.id}"
- page.should have_css("input#edit_recurring_todo_description")
+ expect(page).to have_css("input#edit_recurring_todo_description")
fill_in "edit_recurring_todo_description", :with => new_name
page.find("button#recurring_todo_edit_update_button").click
- page.should_not have_css("div#edit-recurring-todo", :visible => true)
+ expect(page).to_not have_css("div#edit-recurring-todo", :visible => true)
end
When /^I star the pattern "([^\"]*)"$/ do |pattern_name|
pattern = @current_user.recurring_todos.where(:description => pattern_name).first
- pattern.should_not be_nil
+ expect(pattern).to_not be_nil
click_link "star_icon_#{pattern.id}"
end
When /^I delete the pattern "([^"]*)"$/ do |pattern_name|
pattern = @current_user.recurring_todos.where(:description => pattern_name).first
- pattern.should_not be_nil
+ expect(pattern).to_not be_nil
handle_js_confirm do
click_link "delete_icon_#{pattern.id}"
end
- get_confirm_text.should == "Are you sure that you want to delete the recurring action '#{pattern_name}'?"
+ expect(get_confirm_text).to eq("Are you sure that you want to delete the recurring action '#{pattern_name}'?")
- page.should_not have_css("#delete_icon_#{pattern.id}")
+ expect(page).to_not have_css("#delete_icon_#{pattern.id}")
end
When /^I mark the pattern "([^"]*)" as (complete|active)$/ do |pattern_name, state|
pattern = @current_user.recurring_todos.where(:description => pattern_name).first
- pattern.should_not be_nil
- pattern.completed?.should(state=="complete" ? be_false : be_true)
+ expect(pattern).to_not be_nil
+ expect(pattern.completed?).to be (state != "complete")
page.find("#check_#{pattern.id}").click
wait_for_ajax
wait_for_animations_to_end
@@ -79,7 +79,7 @@ end
When /^I follow the recurring todo link of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
page.find(:xpath, "//div[@id='todo_#{todo.id}']//a[@class='recurring_icon']/img").click
sleep 1 # wait for page to load
@@ -89,21 +89,21 @@ Then /^the state list "([^"]*)" should be empty$/ do |state|
empty_id = "recurring-todos-empty-nd" if state.downcase == "active"
empty_id = "completed-empty-nd" if state.downcase == "completed"
empty_msg = page.find("div##{empty_id}")
- empty_msg.visible?.should be_true
+ expect(empty_msg.visible?).to be true
end
Then /^the pattern "([^\"]*)" should be starred$/ do |pattern_name|
pattern = @current_user.recurring_todos.where(:description => pattern_name).first
- pattern.should_not be_nil
- page.should have_xpath("//div[@id='recurring_todo_#{pattern.id}']//img[@class='todo_star starred']")
+ expect(pattern).to_not be_nil
+ expect(page).to have_xpath("//div[@id='recurring_todo_#{pattern.id}']//img[@class='todo_star starred']")
end
Then /^I should see the form for "([^\"]*)" recurrence pattern$/ do |recurrence_period|
- page.should have_css("#recurring_#{recurrence_period.downcase}", :visible => true)
+ expect(page).to have_css("#recurring_#{recurrence_period.downcase}", :visible => true)
end
Then /^the pattern "([^"]*)" should be in the state list "([^"]*)"$/ do |pattern_name, state_name|
pattern = @current_user.recurring_todos.where(:description => pattern_name).first
- pattern.should_not be_nil
- page.should have_xpath("//div[@id='#{state_name}_recurring_todos_container']//div[@id='recurring_todo_#{pattern.id}']")
+ expect(pattern).to_not be_nil
+ expect(page).to have_xpath("//div[@id='#{state_name}_recurring_todos_container']//div[@id='recurring_todo_#{pattern.id}']")
end
diff --git a/features/step_definitions/shared_new_todo_steps.rb b/features/step_definitions/shared_new_todo_steps.rb
index 612c579e..6b19c970 100644
--- a/features/step_definitions/shared_new_todo_steps.rb
+++ b/features/step_definitions/shared_new_todo_steps.rb
@@ -1,15 +1,15 @@
Then /^the single action form should be visible$/ do
- page.should have_css("#todo_new_action", :visible => true)
+ expect(page).to have_css("#todo_new_action", :visible => true)
end
Then /^the single action form should not be visible$/ do
- page.should_not have_css("#todo_new_action", :visible=>true)
+ expect(page).to_not have_css("#todo_new_action", :visible=>true)
end
Then /^the multiple action form should be visible$/ do
- page.should have_css("#todo_multi_add", :visible => true)
+ expect(page).to have_css("#todo_multi_add", :visible => true)
end
Then /^the multiple action form should not be visible$/ do
- page.should_not have_css("#todo_multi_add", :visible=>true)
+ expect(page).to_not have_css("#todo_multi_add", :visible=>true)
end
\ No newline at end of file
diff --git a/features/step_definitions/stats_steps.rb b/features/step_definitions/stats_steps.rb
index 619ebf6d..53c60028 100644
--- a/features/step_definitions/stats_steps.rb
+++ b/features/step_definitions/stats_steps.rb
@@ -4,7 +4,7 @@ When /^I click on the chart for actions done in the last 12 months$/ do
end
Then /^I should see a chart$/ do
- page.should have_css("div.open-flash-chart")
+ expect(page).to have_css("div.open-flash-chart")
end
When /^I click on the chart for running time of all incomplete actions$/ do
diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb
index cf782492..9eaf5c38 100644
--- a/features/step_definitions/todo_create_steps.rb
+++ b/features/step_definitions/todo_create_steps.rb
@@ -17,7 +17,7 @@ Given(/^I have a todo "([^"]*)" in the context "([^"]*)" in the project "([^"]*)
step "I have a todo \"#{description}\" in the context \"#{context_name}\""
@project = @current_user.projects.where(:name => project_name).first_or_create
- @project.should_not be_nil
+ expect(@project).to_not be_nil
@todo.project = @project
@todo.save!
@@ -189,7 +189,7 @@ end
Given /^I have a project "([^"]*)" that has the following (todos|deferred todos)$/ do |project_name, kind_of_todo, todos|
step "I have a project called \"#{project_name}\""
- @project.should_not be_nil
+ expect(@project).to_not be_nil
todos.hashes.each do |todo|
new_todo = @current_user.todos.create!(
@@ -242,7 +242,7 @@ When /^I submit a new action with description "([^"]*)" with a dependency on "([
click_first_line_of_auto_complete
new_dependency_line = "//li[@id='pred_#{predecessor.id}']"
- page.should have_xpath(new_dependency_line, :visible => true)
+ expect(page).to have_xpath(new_dependency_line, :visible => true)
submit_next_action_form
end
diff --git a/features/step_definitions/todo_edit_steps.rb b/features/step_definitions/todo_edit_steps.rb
index 860ba241..ad8c91f9 100644
--- a/features/step_definitions/todo_edit_steps.rb
+++ b/features/step_definitions/todo_edit_steps.rb
@@ -2,7 +2,7 @@
When /^I mark "([^"]*)" as complete$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
check "mark_complete_#{todo.id}"
@@ -12,7 +12,7 @@ end
When /^I mark "([^"]*)" as uncompleted$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
uncheck "mark_complete_#{todo.id}"
@@ -30,12 +30,12 @@ end
When /^I star the action "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
- page.should have_xpath(xpath_unstarred)
+ expect(page).to have_xpath(xpath_unstarred)
star_img = "//img[@id='star_img_#{todo.id}']"
page.find(:xpath, star_img).click
@@ -43,22 +43,22 @@ When /^I star the action "([^"]*)"$/ do |action_description|
wait_for_ajax
wait_for_animations_to_end
- page.should have_xpath(xpath_starred)
+ expect(page).to have_xpath(xpath_starred)
end
When /^I unstar the action "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
- page.should have_xpath(xpath_starred)
+ expect(page).to have_xpath(xpath_starred)
star_img = "//img[@id='star_img_#{todo.id}']"
page.find(:xpath, star_img).click
- page.should have_xpath(xpath_unstarred)
+ expect(page).to have_xpath(xpath_unstarred)
end
####### Editing a todo using Edit Form #######
@@ -87,7 +87,7 @@ end
When /^I edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
within "form.edit_todo_form" do
@@ -98,7 +98,7 @@ end
When /^I try to edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
within "form.edit_todo_form" do
@@ -112,7 +112,7 @@ end
When /^I edit the due date of "([^"]*)" to "([^"]*)"$/ do |action_description, date|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
fill_in "due_todo_#{todo.id}", :with => date
@@ -131,7 +131,7 @@ end
When /^I clear the due date of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
# use all()[0] to get the first todo. This is for calendar page where you can have
@@ -147,7 +147,7 @@ end
When /^I edit the show from date of "([^"]*)" to next month$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
fill_in "show_from_todo_#{todo.id}", :with => format_date(todo.created_at + 1.month)
@@ -156,7 +156,7 @@ end
When /^I remove the show from date from "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
page.find(:xpath, "//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img").click
@@ -169,7 +169,7 @@ end
When /^I defer "([^"]*)" for 1 day$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_submenu_for(todo) do
click_link "defer_1_todo_#{todo.id}"
@@ -181,7 +181,7 @@ end
When /^I edit the tags of "([^"]*)" to "([^"]*)"$/ do |action_description, tags|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_edit_form_for(todo)
within "form#form_todo_#{todo.id}" do
@@ -192,13 +192,13 @@ end
When /^I make a project of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
open_submenu_for(todo) do
click_link "to_project_todo_#{todo.id}"
end
- page.should have_no_css("div#line_todo_#{todo.id}")
+ expect(page).to have_no_css("div#line_todo_#{todo.id}")
wait_for_ajax
wait_for_animations_to_end
end
@@ -207,5 +207,5 @@ end
Then /^I should see an error message$/ do
error_block = "//form/div[@id='edit_error_status']"
- page.should have_xpath(error_block)
+ expect(page).to have_xpath(error_block)
end
\ No newline at end of file
diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb
index a574d6d2..83ed2975 100644
--- a/features/step_definitions/todo_steps.rb
+++ b/features/step_definitions/todo_steps.rb
@@ -12,7 +12,7 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
click_link "delete_todo_#{todo.id}"
end
end
- get_confirm_text.should == "Are you sure that you want to delete the action '#{todo.description}'?"
+ expect(get_confirm_text).to eq("Are you sure that you want to delete the action '#{todo.description}'?")
wait_for_ajax
end
@@ -25,135 +25,135 @@ end
When /^I open the notes of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
page.find(:xpath, "//div[@id='line_todo_#{todo.id}']/div/a/img").click
- page.should have_xpath("//div[@id='notes_todo_#{todo.id}']", :visible=>true)
+ expect(page).to have_xpath("//div[@id='notes_todo_#{todo.id}']", :visible=>true)
end
####### THEN #######
Then /^I should see a starred "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
- page.should have_xpath(xpath_starred)
+ expect(page).to have_xpath(xpath_starred)
end
Then /^I should see an unstarred "([^"]*)"$/ do |action_description|
todo = @current_user.todos.where(:description => action_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
- page.should have_xpath(xpath_starred)
+ expect(page).to have_xpath(xpath_starred)
end
Then /^I should see ([0-9]+) todos$/ do |count|
total = page.all("div.item-container").inject(0) { |s, e| s+=1 }
- total.should == count.to_i
+ expect(total).to eq(count.to_i)
end
Then /^I should see the todo "([^\"]*)"$/ do |todo_description|
- page.should have_xpath("//span[.=\"#{todo_description}\"]", :visible => true)
+ expect(page).to have_xpath("//span[.=\"#{todo_description}\"]", :visible => true)
end
Then /^I should not see the todo "([^\"]*)"$/ do |todo_description|
- page.should_not have_xpath("//span[.=\"#{todo_description}\"]", :visible => true)
+ expect(page).to_not have_xpath("//span[.=\"#{todo_description}\"]", :visible => true)
end
Then /^I should see a completed todo "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
# only completed todos have a grey span with the completed_at date
xpath = "//div[@id='line_todo_#{todo.id}']/div/span[@class='grey']"
- page.should have_xpath(xpath, :visible=>true)
+ expect(page).to have_xpath(xpath, :visible=>true)
end
Then /^I should see an active todo "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath = "//div[@id='line_todo_#{todo.id}']/img[@class='grip']"
- page.should have_xpath(xpath, :visible=>true)
+ expect(page).to have_xpath(xpath, :visible=>true)
end
Then /^the number of actions should be (\d+)$/ do |count|
- @current_user.todos.count.should == count.to_i
+ expect(@current_user.todos.count).to eq(count.to_i)
end
Then /^a confirmation for adding a new context "([^"]*)" should be asked$/ do |context_name|
- get_confirm_text.should == "New context '#{context_name}' will be also created. Are you sure?"
+ expect(get_confirm_text).to eq("New context '#{context_name}' will be also created. Are you sure?")
end
Then /^the selected project should be "([^"]*)"$/ do |content|
# Works for mobile. TODO: make it work for both mobile and non-mobile
if content.blank?
- page.has_css?("select#todo_project_id option[selected='selected']").should be_false
+ expect(page.has_css?("select#todo_project_id option[selected='selected']")).to be false
else
- page.find("select#todo_project_id option[selected='selected']").text.should =~ /#{content}/
+ expect(page.find("select#todo_project_id option[selected='selected']").text).to match(/#{content}/)
end
end
Then /^the selected context should be "([^"]*)"$/ do |content|
# Works for mobile. TODO: make it work for both mobile and non-mobile
if content.blank?
- page.has_css?("select#todo_context_id option[selected='selected']").should be_false
+ expect(page.has_css?("select#todo_context_id option[selected='selected']")).to be false
else
- page.find("select#todo_context_id option[selected='selected']").text.should =~ /#{content}/
+ expect(page.find("select#todo_context_id option[selected='selected']").text).to match(/#{content}/)
end
end
Then /^I should see the page selector$/ do
- page.should have_xpath(".//a[@class='next_page']")
+ expect(page).to have_xpath(".//a[@class='next_page']")
end
Then /^the page should be "([^"]*)"$/ do |page_number|
- page.find(:xpath, ".//div[@class='paginate_header']//em[@class='current']").text.should == page_number
+ expect(page.find(:xpath, ".//div[@class='paginate_header']//em[@class='current']").text).to eq(page_number)
end
Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_project_name']"
- project_name.should == page.find(:xpath, xpath).value
+ expect(project_name).to eq(page.find(:xpath, xpath).value)
end
Then /^the default context of the new todo form should be "([^"]*)"$/ do |context_name|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']"
- context_name.should == page.find(:xpath, xpath).value
+ expect(context_name).to eq(page.find(:xpath, xpath).value)
end
Then /^the tag field in the new todo form should be empty$/ do
xpath= "//form[@id='todo-form-new-action']/input[@id='tag_list']"
- page.find(:xpath, xpath).value.blank?.should be_true
+ expect(page.find(:xpath, xpath).value).to be_blank
end
Then /^the tag field in the new todo form should be "([^"]*)"$/ do |tag_list|
xpath= "//form[@id='todo-form-new-action']/input[@id='tag_list']"
- tag_list.should == page.find(:xpath, xpath).value
+ expect(tag_list).to eq(page.find(:xpath, xpath).value)
end
Then /^the tags of "([^"]*)" should be "([^"]*)"$/ do |todo_description, tag_list|
- find_todo(todo_description).tag_list.should == tag_list
+ expect(find_todo(todo_description).tag_list).to eq(tag_list)
end
Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |desc|
todo = @current_user.todos.where(:description => desc).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
xpath = "//div[@id='completed_container']//a[@href='/todos/#{todo.id}.m']"
- page.should have_xpath(xpath)
+ expect(page).to have_xpath(xpath)
end
Then /^I should (see|not see) the notes of "([^"]*)"$/ do |visible, todo_description|
todo = @current_user.todos.where(:description => todo_description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
- page.find("div#notes_todo_#{todo.id}").send(visible=="see" ? "should" : "should_not", be_visible)
+ expect(page.find("div#notes_todo_#{todo.id}")).send(visible=="see" ? :to : :to_not, be_visible)
end
Then /^I should (see|not see) the empty tickler message$/ do |see|
elem = find("div#no_todos_in_view")
- elem.send(see=="see" ? "should" : "should_not", be_visible)
+ expect(elem).send(see=="see" ? :to : :to_not, be_visible)
end
diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb
index 335b5e4c..80bb7b63 100644
--- a/features/step_definitions/user_steps.rb
+++ b/features/step_definitions/user_steps.rb
@@ -19,13 +19,13 @@ Given /^the following user records with hash algorithm$/ do |table|
when 'bcrypt'
user.change_password( password, password )
user.reload
- BCrypt::Password.new(user.crypted_password).should == password
+ expect(BCrypt::Password.new(user.crypted_password)).to eq(password)
when 'sha1'
user.password = user.password_confirmation = nil
user.send(:write_attribute, :crypted_password, user.sha1(password))
user.save
user.reload
- user.crypted_password.should == user.sha1(password)
+ expect(user.crypted_password).to eq(user.sha1(password))
else
raise "Unknown hashing algorithm: #{algorithm}"
end
@@ -49,14 +49,14 @@ When /^I delete the user "([^\"]*)"$/ do |username|
# click "//tr[@id='user-3']//img"
# assert_confirmation "Warning: this will delete user 'john', all their actions, contexts, project and notes. Are you sure that you want to continue?"
user = User.where(:login => username).first
- user.should_not be_nil
+ expect(user).to_not be_nil
handle_js_confirm do
page.find(:xpath, "//tr[@id='user-#{user.id}']//img").click
end
- get_confirm_text.should == "Warning: this will delete user '#{user.login}', all their actions, contexts, project and notes. Are you sure that you want to continue?"
+ expect(get_confirm_text).to eq("Warning: this will delete user '#{user.login}', all their actions, contexts, project and notes. Are you sure that you want to continue?")
- page.should_not have_css("tr#user-#{user.id}")
+ expect(page).to_not have_css("tr#user-#{user.id}")
end
Then /^I should see that a user named "([^\"]*)" is not present$/ do |username|
diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb
index 0f0af8aa..f3e8a091 100644
--- a/features/step_definitions/web_steps.rb
+++ b/features/step_definitions/web_steps.rb
@@ -101,48 +101,32 @@ Then /^(?:|I )should see JSON:$/ do |expected_json|
require 'json'
expected = JSON.pretty_generate(JSON.parse(expected_json))
actual = JSON.pretty_generate(JSON.parse(response.body))
- expected.should == actual
+ expect(expected).to eq(actual)
end
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
with_scope(selector) do
- if page.respond_to? :should
- page.should have_content(text)
- else
- assert page.has_content?(text)
- end
+ expect(page).to have_content(text)
end
end
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
regexp = Regexp.new(regexp)
with_scope(selector) do
- if page.respond_to? :should
- page.should have_xpath('//*', :text => regexp)
- else
- assert page.has_xpath?('//*', :text => regexp)
- end
+ expect(page).to have_xpath('//*', :text => regexp)
end
end
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
with_scope(selector) do
- if page.respond_to? :should
- page.should have_no_content(text)
- else
- assert page.has_no_content?(text)
- end
+ expect(page).to have_no_content(text)
end
end
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
regexp = Regexp.new(regexp)
with_scope(selector) do
- if page.respond_to? :should
- page.should have_no_xpath('//*', :text => regexp)
- else
- assert page.has_no_xpath?('//*', :text => regexp)
- end
+ expect(page).to have_no_xpath('//*', :text => regexp)
end
end
@@ -150,11 +134,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |
with_scope(selector) do
field = find_field(field)
field_value = (field.tag_name == 'textarea') ? field.text : field.value
- if field_value.respond_to? :should
- field_value.should =~ /#{value}/
- else
- assert_match(/#{value}/, field_value)
- end
+ expect(field_value).to match(/#{value}/)
end
end
@@ -162,43 +142,27 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/
with_scope(selector) do
field = find_field(field)
field_value = (field.tag_name == 'textarea') ? field.text : field.value
- if field_value.respond_to? :should_not
- field_value.should_not =~ /#{value}/
- else
- assert_no_match(/#{value}/, field_value)
- end
+ expect(field_value).to_not match(/#{value}/)
end
end
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
with_scope(selector) do
field_checked = find_field(label)['checked']
- if field_checked.respond_to? :should
- field_checked.should be_true
- else
- assert field_checked
- end
+ expect(field_checked).to be true
end
end
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
with_scope(selector) do
field_checked = find_field(label)['checked']
- if field_checked.respond_to? :should
- field_checked.should be_false
- else
- assert !field_checked
- end
+ expect(field_checked).to be false
end
end
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
- if current_path.respond_to? :should
- current_path.should == path_to(page_name)
- else
- assert_equal path_to(page_name), current_path
- end
+ expect(current_path).to eq(path_to(page_name))
end
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
@@ -207,11 +171,7 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
expected_params = {}
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
- if actual_params.respond_to? :should
- actual_params.should == expected_params
- else
- assert_equal expected_params, actual_params
- end
+ expect(actual_params).to eq(expected_params)
end
Then /^show me the page$/ do
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
index db04f79e..05c2558d 100644
--- a/features/support/hooks.rb
+++ b/features/support/hooks.rb
@@ -4,10 +4,6 @@ AfterStep('@pause') do
end
Before('@aruba') do
- @aruba_timeout_seconds = 5
+ @aruba_timeout_seconds = 10
# print "\nsetting timeout for aruba to #{@aruba_timeout_seconds}\n"
end
-
-After('@reset_time') do
- Timecop.return
-end
\ No newline at end of file
diff --git a/features/support/tracks_form_helper.rb b/features/support/tracks_form_helper.rb
index 6fd06d79..d7805ffb 100644
--- a/features/support/tracks_form_helper.rb
+++ b/features/support/tracks_form_helper.rb
@@ -4,7 +4,7 @@ module TracksFormHelper
edit_link = "div#line_todo_#{todo.id} a#icon_edit_todo_#{todo.id}"
# make sure we can open the edit form
- page.should have_css(edit_link)
+ expect(page).to have_css(edit_link)
# on calendar page there can be more than 1 occurance of a todo, so we select the first here
all(:css, edit_link)[0].click
@@ -17,7 +17,7 @@ module TracksFormHelper
page.find("a#link_edit_context_#{context.id}").click
# wait for the form to appear (which included a submit button)
- page.should have_css("button#submit_context_#{context.id}", :visible=>true)
+ expect(page).to have_css("button#submit_context_#{context.id}", :visible=>true)
end
def submit_form(form_xpath, button_name)
@@ -53,23 +53,23 @@ module TracksFormHelper
end
def wait_for_todo_form_to_go_away(todo)
- page.should_not have_content("button#submit_todo_#{todo.id}")
+ expect(page).to_not have_content("button#submit_todo_#{todo.id}")
end
def wait_for_context_form_to_appear(context)
- page.should have_css("button#submit_context_#{context.id}", :visible=>true)
+ expect(page).to have_css("button#submit_context_#{context.id}", :visible=>true)
end
def wait_for_context_form_to_go_away(context)
# wait for the form to go away
- page.should_not have_css("button#submit_context_#{context.id}", :visible => true)
+ expect(page).to_not have_css("button#submit_context_#{context.id}", :visible => true)
# wait for the changed context to appear
- page.should have_css("a#link_edit_context_#{context.id}", :visible=> true)
+ expect(page).to have_css("a#link_edit_context_#{context.id}", :visible=> true)
end
def open_project_edit_form(project)
click_link "link_edit_project_#{project.id}"
- page.should have_css("button#submit_project_#{project.id}")
+ expect(page).to have_css("button#submit_project_#{project.id}")
end
def submit_project_edit_form(project)
@@ -92,7 +92,7 @@ module TracksFormHelper
wait_for_ajax
wait_for_animations_to_end
- page.should_not have_css("button#submit_project_#{project.id}", :visible => true)
+ expect(page).to_not have_css("button#submit_project_#{project.id}", :visible => true)
end
def edit_project_settings(project)
diff --git a/features/support/tracks_step_helper.rb b/features/support/tracks_step_helper.rb
index 14518010..2effe93b 100644
--- a/features/support/tracks_step_helper.rb
+++ b/features/support/tracks_step_helper.rb
@@ -29,14 +29,14 @@ module TracksStepHelper
def wait_for_ajax
start_time = Time.now
- page.evaluate_script('jQuery.isReady&&jQuery.active==0').class.should_not eql(String)
+ expect(page.evaluate_script('jQuery.isReady&&jQuery.active==0').class).to_not eql(String)
until(page.evaluate_script('jQuery.isReady&&jQuery.active==0') || (start_time + 5.seconds) < Time.now)
sleep 0.05
end
end
def wait_for_auto_complete
- page.should have_css("a.ui-state-focus", :visible => true)
+ expect(page).to have_css("a.ui-state-focus", :visible => true)
end
def click_first_line_of_auto_complete
@@ -44,32 +44,32 @@ module TracksStepHelper
end
def check_xpath_visibility(visible, xpath)
- page.send( (visible=="see" ? :should : :should_not), have_xpath(xpath, :visible => true))
+ expect(page).send( (visible=="see" ? :to : :to_not), have_xpath(xpath, :visible => true))
end
def check_css_visibility(visible, css)
- page.send( (visible=="see" ? :should : :should_not), have_css(css, :visible => true))
+ expect(page).send( (visible=="see" ? :to : :to_not), have_css(css, :visible => true))
end
def check_elem_visibility(visible, elem)
- elem.send(visible=="see" ? :should : :should_not, be_visible)
+ expect(elem).send( (visible=="see" ? :to : :to_not), be_visible)
end
def find_todo(description)
todo = @current_user.todos.where(:description => description).first
- todo.should_not be_nil
+ expect(todo).to_not be_nil
return todo
end
def find_context(context_name)
context = @current_user.contexts.where(:name => context_name).first
- context.should_not be_nil
+ expect(context).to_not be_nil
return context
end
def find_project(project_name)
project = @current_user.projects.where(:name => project_name).first
- project.should_not be_nil
+ expect(project).to_not be_nil
return project
end
@@ -102,12 +102,12 @@ module TracksStepHelper
# click menu
view_menu_link = "#{view_menu} a#menu_view_link"
- page.should have_css(view_menu_link, :visible => true)
+ expect(page).to have_css(view_menu_link, :visible => true)
page.find(view_menu_link).click
# wait for menu to be visible
view_menu_item = "#{view_menu} li#menu_view_toggle_contexts"
- page.should have_css(view_menu_item)
+ expect(page).to have_css(view_menu_item)
within view_menu do
yield
@@ -118,7 +118,7 @@ module TracksStepHelper
wait_for_animations_to_end
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
- page.should have_css(submenu_arrow, :visible=>true)
+ expect(page).to have_css(submenu_arrow, :visible=>true)
arrow = page.find(submenu_arrow, :match => :first)
arrow.click
@@ -148,4 +148,4 @@ module TracksStepHelper
page.execute_script(js)
end
-end
\ No newline at end of file
+end
diff --git a/features/view_done.feature b/features/view_done.feature
index 701fb938..ea4bf133 100644
--- a/features/view_done.feature
+++ b/features/view_done.feature
@@ -153,24 +153,13 @@ Feature: Show done
| all done actions page for project "test project"| "test project" project | |
| all done actions page for tag "starred" | home page | in the context container for "@pc" |
- @javascript @reset_time
+ @javascript
Scenario: Activating the last todo will show empty message
- Given the date is "2013-03-11"
- And I have a completed todo with description "todo 2" in context "@pc" completed 1 days ago
- And I have a completed todo with description "todo 3" in context "@pc" completed 7 days ago
When I go to the done actions page
Then I should see "todo 1" in the done today 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
When I mark the completed todo "todo 1" active
Then I should not see the todo "todo 1"
And I should see empty message for done today of done actions
- When I mark the completed todo "todo 2" active
- Then I should not see the todo "todo 2"
- And I should see empty message for done this week of done actions
- When I mark the completed todo "todo 3" active
- Then I should not see the todo "todo 3"
- And I should see empty message for done this month of done actions
@javascript
Scenario Outline: I can toggle the star of a todo from the done pages
diff --git a/lib/is_taggable.rb b/lib/is_taggable.rb
index f98895f1..122f0409 100644
--- a/lib/is_taggable.rb
+++ b/lib/is_taggable.rb
@@ -9,10 +9,10 @@ module IsTaggable
has_many :taggings, :as => :taggable
has_many :tags, :through => :taggings do
def to_s
- self.map(&:name).sort.join(Tag::JOIN_DELIMITER)
+ self.to_a.map(&:name).sort.join(Tag::JOIN_DELIMITER)
end
def all_except_starred
- self.reject{|tag| tag.name == Todo::STARRED_TAG_NAME}
+ self.to_a.reject{|tag| tag.name == Todo::STARRED_TAG_NAME}
end
end
@@ -31,7 +31,7 @@ module IsTaggable
# Transactions may not be ideal for you here; be aware.
Tag.transaction do
- current = tags.map(&:name)
+ current = tags.to_a.map(&:name)
_add_tags(list - current)
_remove_tags(current - list)
end
diff --git a/lib/tasks/continuous_integration.rake b/lib/tasks/continuous_integration.rake
index f54ede26..189d7263 100644
--- a/lib/tasks/continuous_integration.rake
+++ b/lib/tasks/continuous_integration.rake
@@ -9,7 +9,7 @@ task :ci do |t|
require 'simplecov'
SimpleCov.start 'rails'
- [:environment, 'db:migrate', 'test:all', 'cucumber'].each do |t|
+ [:environment, 'test:all', 'cucumber'].each do |t|
Rake::Task[t].invoke
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/tracks.rake b/lib/tasks/tracks.rake
index 2a5ef952..f6efb97f 100644
--- a/lib/tasks/tracks.rake
+++ b/lib/tasks/tracks.rake
@@ -1,7 +1,7 @@
namespace :tracks do
desc 'Replace the password of USER with a new one.'
task :password => :environment do
- require "highline/import"
+ require "io/console"
user = User.find_by_login(ENV['USER'])
if user.nil?
@@ -10,14 +10,18 @@ namespace :tracks do
end
puts "Changing Tracks password for #{ENV['USER']}."
- password = ask("New password: ") { |q| q.echo = false }
- password_confirmation = ask('Retype new password: ') { |q| q.echo = false }
+ print "New password: "
+ password = STDIN.noecho(&:gets).chomp
+ print "\nRetype new password: "
+ password_confirmation = STDIN.noecho(&:gets).chomp
+ puts
begin
user.change_password(password, password_confirmation)
+ puts "Password changed."
rescue ActiveRecord::RecordInvalid
puts "Sorry, we couldn't change #{ENV['USER']}'s password: "
- user.errors.each_full { |msg| puts "- #{msg}\n" }
+ user.errors.full_messages.each { |msg| puts "- #{msg}\n" }
end
end
diff --git a/lib/tracks/utils.rb b/lib/tracks/utils.rb
index 262f01ee..09e842cd 100644
--- a/lib/tracks/utils.rb
+++ b/lib/tracks/utils.rb
@@ -27,10 +27,11 @@ module Tracks
rendered = helpers.auto_link(rendered, :link => :urls)
# add onenote and message protocols
- Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'onenote'
- Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'message'
+ config = Sanitize::Config.merge(Sanitize::Config::RELAXED,
+ :protocols => { 'a' => {'href' => Sanitize::Config::RELAXED[:protocols]['a']['href'] + ['onenote', 'message']}}
+ )
- rendered = Sanitize.clean(rendered, Sanitize::Config::RELAXED)
+ rendered = Sanitize.clean(rendered, config)
return rendered.html_safe
end
diff --git a/script/cucumber b/script/cucumber
deleted file mode 100755
index 7fa5c920..00000000
--- a/script/cucumber
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-
-vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
-if vendored_cucumber_bin
- load File.expand_path(vendored_cucumber_bin)
-else
- require 'rubygems' unless ENV['NO_RUBYGEMS']
- require 'cucumber'
- load Cucumber::BINARY
-end
diff --git a/test/controllers/calendar_controller_test.rb b/test/controllers/calendar_controller_test.rb
index d4f47eaa..a2ce72a3 100644
--- a/test/controllers/calendar_controller_test.rb
+++ b/test/controllers/calendar_controller_test.rb
@@ -1,4 +1,4 @@
-require_relative '../test_helper'
+require 'test_helper'
class CalendarControllerTest < ActionController::TestCase
diff --git a/test/controllers/context_actions_data_test.rb b/test/controllers/context_actions_data_test.rb
index 7bce3991..0bcaae6a 100644
--- a/test/controllers/context_actions_data_test.rb
+++ b/test/controllers/context_actions_data_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ContextActionsDataTest < ActionController::TestCase
tests StatsController
diff --git a/test/controllers/contexts_controller_test.rb b/test/controllers/contexts_controller_test.rb
index d1295e18..56492154 100644
--- a/test/controllers/contexts_controller_test.rb
+++ b/test/controllers/contexts_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ContextsControllerTest < ActionController::TestCase
fixtures :users, :preferences, :contexts
diff --git a/test/controllers/data_controller_test.rb b/test/controllers/data_controller_test.rb
index e78c75e8..4f003fae 100644
--- a/test/controllers/data_controller_test.rb
+++ b/test/controllers/data_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class DataControllerTest < ActionController::TestCase
diff --git a/test/controllers/feedlist_controller_test.rb b/test/controllers/feedlist_controller_test.rb
index 1122be5f..a14a9415 100644
--- a/test/controllers/feedlist_controller_test.rb
+++ b/test/controllers/feedlist_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class FeedlistControllerTest < ActionController::TestCase
diff --git a/test/controllers/integrations_controller_test.rb b/test/controllers/integrations_controller_test.rb
index ba382a21..6e15235c 100644
--- a/test/controllers/integrations_controller_test.rb
+++ b/test/controllers/integrations_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class IntegrationsControllerTest < ActionController::TestCase
diff --git a/test/controllers/login_controller_test.rb b/test/controllers/login_controller_test.rb
index 3e8892d8..84fe70a0 100644
--- a/test/controllers/login_controller_test.rb
+++ b/test/controllers/login_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class LoginControllerTest < ActionController::TestCase
fixtures :preferences, :users
diff --git a/test/controllers/mailgun_controller_test.rb b/test/controllers/mailgun_controller_test.rb
index b151afc9..876cc9bd 100644
--- a/test/controllers/mailgun_controller_test.rb
+++ b/test/controllers/mailgun_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class MailgunControllerTest < ActionController::TestCase
diff --git a/test/controllers/message_gateway_test.rb b/test/controllers/message_gateway_test.rb
index ea84127d..d64f6adc 100644
--- a/test/controllers/message_gateway_test.rb
+++ b/test/controllers/message_gateway_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class MessageGatewayTest < ActiveSupport::TestCase
diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb
index a83dabf1..9c14d236 100644
--- a/test/controllers/notes_controller_test.rb
+++ b/test/controllers/notes_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class NotesControllerTest < ActionController::TestCase
diff --git a/test/controllers/preferences_controller_test.rb b/test/controllers/preferences_controller_test.rb
index 9d55e83e..f87eb1a0 100644
--- a/test/controllers/preferences_controller_test.rb
+++ b/test/controllers/preferences_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class PreferencesControllerTest < ActionController::TestCase
diff --git a/test/controllers/projects_controller_test.rb b/test/controllers/projects_controller_test.rb
index 1b2b557f..da4e196f 100644
--- a/test/controllers/projects_controller_test.rb
+++ b/test/controllers/projects_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ProjectsControllerTest < ActionController::TestCase
diff --git a/test/controllers/recurring_todos_controller_test.rb b/test/controllers/recurring_todos_controller_test.rb
index b8ce950e..c9c2bce7 100644
--- a/test/controllers/recurring_todos_controller_test.rb
+++ b/test/controllers/recurring_todos_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class RecurringTodosControllerTest < ActionController::TestCase
@@ -70,6 +70,54 @@ class RecurringTodosControllerTest < ActionController::TestCase
assert_equal orig_todo_count+1, Todo.count
end
+ def test_invalid_recurring_todo
+ login_as(:admin_user)
+ orig_rt_count = RecurringTodo.count
+ orig_todo_count = Todo.count
+ put :create,
+ "context_name"=>"library",
+ "project_name"=>"Build a working time machine",
+ "recurring_todo" =>
+ {
+ "daily_every_x_days"=>"1",
+ "daily_selector"=>"daily_every_x_day",
+ "description"=>"",
+ "end_date" => "31/08/2010",
+ "ends_on" => "ends_on_end_date",
+ "monthly_day_of_week" => "1",
+ "monthly_every_x_day" => "18",
+ "monthly_every_x_month2" => "1",
+ "monthly_every_x_month" => "1",
+ "monthly_every_xth_day"=>"1",
+ "monthly_selector"=>"monthly_every_x_day",
+ "notes"=>"with some notes",
+ "number_of_occurences" => "",
+ "recurring_period"=>"yearly",
+ "recurring_show_days_before"=>"10",
+ "recurring_target"=>"due_date",
+ "recurring_show_always" => "1",
+ "start_from"=>"18/08/2008",
+ "weekly_every_x_week"=>"1",
+ "weekly_return_monday"=>"m",
+ "yearly_day_of_week"=>"1",
+ "yearly_every_x_day"=>"8",
+ "yearly_every_xth_day"=>"1",
+ "yearly_month_of_year2"=>"8",
+ "yearly_month_of_year"=>"6",
+ "yearly_selector"=>"yearly_every_x_day"
+ },
+ "tag_list"=>"one, two, three, four", :format => :js
+
+ # check no new recurring todo added
+ assert_equal orig_rt_count, RecurringTodo.count
+ # check no new todo added
+ assert_equal orig_todo_count, Todo.count
+ # check error message
+ errors = assigns(:recurring_todo).errors
+ assert_equal 1, errors.size
+ assert_equal errors.get(:description), ["can't be blank"]
+ end
+
def test_new_recurring_todo_handles_attribs_outside_rec_todo
login_as(:admin_user)
@@ -183,7 +231,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
# this test is a duplicate of the unit test. Only this test covers the
# codepath in the controllers
- Timecop.travel(Time.local(2012,1,1)) do
+ travel_to Time.local(2012,1,1) do
login_as(:admin_user)
@@ -292,7 +340,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
end
def test_start_on_monthly_rec_todo
- Timecop.travel(Time.local(2012,1,1)) do
+ travel_to Time.local(2012,1,1) do
login_as(:admin_user)
diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb
index 7d99c59d..0c7fda30 100644
--- a/test/controllers/search_controller_test.rb
+++ b/test/controllers/search_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class SearchControllerTest < ActionController::TestCase
diff --git a/test/controllers/stats_controller_test.rb b/test/controllers/stats_controller_test.rb
index 20add95c..2c7e3485 100644
--- a/test/controllers/stats_controller_test.rb
+++ b/test/controllers/stats_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class StatsControllerTest < ActionController::TestCase
@@ -97,7 +97,7 @@ class StatsControllerTest < ActionController::TestCase
end
def test_actions_done_last12months_data
- Timecop.travel(Time.local(2013, 1, 15)) do
+ travel_to Time.local(2013, 1, 15) do
login_as(:admin_user)
@current_user = User.find(users(:admin_user).id)
@current_user.todos.delete_all
@@ -143,7 +143,7 @@ class StatsControllerTest < ActionController::TestCase
end
def test_empty_last12months_data
- Timecop.travel(Time.local(2013, 1, 15)) do
+ travel_to Time.local(2013, 1, 15) do
login_as(:admin_user)
@current_user = User.find(users(:admin_user).id)
@current_user.todos.delete_all
diff --git a/test/controllers/todos_controller_test.rb b/test/controllers/todos_controller_test.rb
index 8540d450..fbf8223f 100644
--- a/test/controllers/todos_controller_test.rb
+++ b/test/controllers/todos_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TodosControllerTest < ActionController::TestCase
@@ -435,7 +435,7 @@ class TodosControllerTest < ActionController::TestCase
login_as(:admin_user)
# given a todo in the tickler that should be activated
- Timecop.travel(2.weeks.ago) do
+ travel_to 2.weeks.ago do
create_todo(
description: "tickler",
show_from: 1.week.from_now.
@@ -715,7 +715,7 @@ class TodosControllerTest < ActionController::TestCase
end
def test_toggle_check_on_rec_todo_show_from_today
- Timecop.travel(2014, 1, 15) do
+ travel_to Time.zone.local(2014, 1, 15) do
login_as(:admin_user)
# link todo_1 and recurring_todo_1
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb
index 4590c102..92051237 100644
--- a/test/controllers/users_controller_test.rb
+++ b/test/controllers/users_controller_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class UsersControllerTest < ActionController::TestCase
diff --git a/test/integration/context_xml_api_test.rb b/test/integration/context_xml_api_test.rb
index 71e6abab..26d5b4ec 100644
--- a/test/integration/context_xml_api_test.rb
+++ b/test/integration/context_xml_api_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ContextXmlApiTest < ActionDispatch::IntegrationTest
diff --git a/test/integration/feed_smoke_test.rb b/test/integration/feed_smoke_test.rb
index f5748d4f..6eb762bd 100644
--- a/test/integration/feed_smoke_test.rb
+++ b/test/integration/feed_smoke_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path( File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class FeedSmokeTest < ActionDispatch::IntegrationTest
diff --git a/test/integration/project_xml_api_test.rb b/test/integration/project_xml_api_test.rb
index 2b5a344b..9cfbfab8 100644
--- a/test/integration/project_xml_api_test.rb
+++ b/test/integration/project_xml_api_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ProjectXmlApiTest < ActionDispatch::IntegrationTest
@@project_name = "My New Project"
diff --git a/test/integration/recurring_todos_test.rb b/test/integration/recurring_todos_test.rb
index 39e2fc77..bad00387 100644
--- a/test/integration/recurring_todos_test.rb
+++ b/test/integration/recurring_todos_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class RecurringTodosTest < ActionDispatch::IntegrationTest
diff --git a/test/integration/stories_test.rb b/test/integration/stories_test.rb
index 7935194b..471d4f09 100644
--- a/test/integration/stories_test.rb
+++ b/test/integration/stories_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class StoriesTest < ActionDispatch::IntegrationTest
diff --git a/test/integration/todo_xml_api_test.rb b/test/integration/todo_xml_api_test.rb
index 8234c056..384bc889 100644
--- a/test/integration/todo_xml_api_test.rb
+++ b/test/integration/todo_xml_api_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TodoXmlApiTest < ActionDispatch::IntegrationTest
@@valid_postdata = "this will succeed104"
@@ -17,7 +17,7 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
get '/tickler.xml', {}, {}
assert_response 401
- get "/tickler.xml", {}, {'HTT_AUTHORIZATION' => "Basic " + Base64.encode64("wrong:wrong"),'ACCEPT' => 'application/xml'}
+ get "/tickler.xml", {}, {'HTTP_AUTHORIZATION' => "Basic " + Base64.encode64("wrong:wrong"),'ACCEPT' => 'application/xml'}
assert_response 401
end
@@ -32,6 +32,19 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
assert_no_tag :tag => "user_id"
end
+ def test_get_index_with_only_active_todos
+ authenticated_get_xml "/todos.xml", @user.login, @password, {}
+ assert_response 200
+
+ all_todo_count = assigns['xml_todos']
+
+ authenticated_get_xml "/todos.xml?limit_to_active_todos=1", @user.login, @password, {}
+ assert_response 200
+
+ active_todo_count = assigns['xml_todos']
+ assert all_todo_count != active_todo_count, "active should be less than all todos"
+ end
+
def test_create_todo_with_show_from
old_count = @user.todos.count
authenticated_post_xml_to_todo_create "
diff --git a/test/integration/users_xml_api_test.rb b/test/integration/users_xml_api_test.rb
index 3985882d..07b25d44 100644
--- a/test/integration/users_xml_api_test.rb
+++ b/test/integration/users_xml_api_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class UsersXmlApiTest < ActionDispatch::IntegrationTest
diff --git a/test/minimal_test_helper.rb b/test/minimal_test_helper.rb
index d1d73ae9..36afb23a 100644
--- a/test/minimal_test_helper.rb
+++ b/test/minimal_test_helper.rb
@@ -1,5 +1,5 @@
ENV["RAILS_ENV"] ||= "test"
-require 'test/unit'
+require 'minitest/autorun'
require 'mocha/setup'
$:.unshift File.dirname(File.dirname(__FILE__))
diff --git a/test/models/attribute_handler_test.rb b/test/models/attribute_handler_test.rb
index 54d6bddd..c47f236b 100644
--- a/test/models/attribute_handler_test.rb
+++ b/test/models/attribute_handler_test.rb
@@ -1,4 +1,4 @@
-require_relative '../test_helper'
+require 'test_helper'
class AttributeHandlerTest < ActiveSupport::TestCase
fixtures :users
diff --git a/test/models/context_test.rb b/test/models/context_test.rb
index b3b56196..e699609e 100644
--- a/test/models/context_test.rb
+++ b/test/models/context_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ContextTest < ActiveSupport::TestCase
fixtures :contexts, :todos, :recurring_todos, :users, :preferences
diff --git a/test/models/is_taggable_test.rb b/test/models/is_taggable_test.rb
index dfd97400..93b7caf2 100644
--- a/test/models/is_taggable_test.rb
+++ b/test/models/is_taggable_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class IsTaggableTest < ActiveSupport::TestCase
fixtures :todos, :recurring_todos
diff --git a/test/models/notes_test.rb b/test/models/notes_test.rb
index 695c0329..c3c65d68 100644
--- a/test/models/notes_test.rb
+++ b/test/models/notes_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class NotesTest < ActiveSupport::TestCase
fixtures :notes
diff --git a/test/models/pie_chart_data_test.rb b/test/models/pie_chart_data_test.rb
index d5933d12..697b6c1b 100644
--- a/test/models/pie_chart_data_test.rb
+++ b/test/models/pie_chart_data_test.rb
@@ -1,8 +1,8 @@
-require File.expand_path(File.dirname(__FILE__) + '/../minimal_test_helper')
+require 'minimal_test_helper'
require 'app/models/stats/pie_chart_data'
require 'active_support/core_ext/string'
-class Stats::PieChartDataTest < Test::Unit::TestCase
+class Stats::PieChartDataTest < Minitest::Test
def setup
xx = { :stats => { :other_actions_label => '(other)' } }
diff --git a/test/models/preference_test.rb b/test/models/preference_test.rb
index 2fe8e273..688d003f 100644
--- a/test/models/preference_test.rb
+++ b/test/models/preference_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class PreferenceTest < ActiveSupport::TestCase
fixtures :users, :preferences
diff --git a/test/models/project_from_todo_test.rb b/test/models/project_from_todo_test.rb
index 755df908..b2d0bd24 100644
--- a/test/models/project_from_todo_test.rb
+++ b/test/models/project_from_todo_test.rb
@@ -1,4 +1,4 @@
-require_relative '../test_helper'
+require 'test_helper'
require_relative '../../lib/project_from_todo'
class ProjectFromTodoTest < ActiveSupport::TestCase
diff --git a/test/models/project_test.rb b/test/models/project_test.rb
index 0605291c..e2f7b5b2 100644
--- a/test/models/project_test.rb
+++ b/test/models/project_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class ProjectTest < ActiveSupport::TestCase
fixtures :projects, :contexts, :todos, :recurring_todos, :users, :preferences
diff --git a/test/models/recurring_todo_test.rb b/test/models/recurring_todo_test.rb
index 7ac14610..4e145f67 100644
--- a/test/models/recurring_todo_test.rb
+++ b/test/models/recurring_todo_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class RecurringTodoTest < ActiveSupport::TestCase
diff --git a/test/models/recurring_todos/abstract_recurring_todos_builder_test.rb b/test/models/recurring_todos/abstract_recurring_todos_builder_test.rb
index 5c051eb5..82429723 100644
--- a/test/models/recurring_todos/abstract_recurring_todos_builder_test.rb
+++ b/test/models/recurring_todos/abstract_recurring_todos_builder_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/abstract_repeat_pattern_test.rb b/test/models/recurring_todos/abstract_repeat_pattern_test.rb
index d0bcf98b..a4304aa8 100644
--- a/test/models/recurring_todos/abstract_repeat_pattern_test.rb
+++ b/test/models/recurring_todos/abstract_repeat_pattern_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
@@ -101,7 +101,7 @@ module RecurringTodos
end
def test_determine_start
- Timecop.travel(2013,1,1) do
+ travel_to Time.zone.local(2013,1,1) do
rt = create_recurring_todo
assert_equal "2013-01-01 00:00:00", rt.send(:determine_start, nil).to_s(:db), "no previous date, use today"
assert_equal "2013-01-01 00:00:00", rt.send(:determine_start, nil, 1.day).to_s(:db), "no previous date, use today without offset"
diff --git a/test/models/recurring_todos/daily_recurring_todos_builder_test.rb b/test/models/recurring_todos/daily_recurring_todos_builder_test.rb
index b6463c9b..6ceb11c7 100644
--- a/test/models/recurring_todos/daily_recurring_todos_builder_test.rb
+++ b/test/models/recurring_todos/daily_recurring_todos_builder_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/daily_repeat_pattern_test.rb b/test/models/recurring_todos/daily_repeat_pattern_test.rb
index edfd4977..520ea346 100644
--- a/test/models/recurring_todos/daily_repeat_pattern_test.rb
+++ b/test/models/recurring_todos/daily_repeat_pattern_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/form_helper_test.rb b/test/models/recurring_todos/form_helper_test.rb
index 80ae0c0c..c3a6be4e 100644
--- a/test/models/recurring_todos/form_helper_test.rb
+++ b/test/models/recurring_todos/form_helper_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/monthly_recurring_todos_builder_test.rb b/test/models/recurring_todos/monthly_recurring_todos_builder_test.rb
index f02299ca..a4d7d45a 100644
--- a/test/models/recurring_todos/monthly_recurring_todos_builder_test.rb
+++ b/test/models/recurring_todos/monthly_recurring_todos_builder_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/monthly_repeat_pattern_test.rb b/test/models/recurring_todos/monthly_repeat_pattern_test.rb
index 5603108f..67e28741 100644
--- a/test/models/recurring_todos/monthly_repeat_pattern_test.rb
+++ b/test/models/recurring_todos/monthly_repeat_pattern_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/recurring_todos_builder_test.rb b/test/models/recurring_todos/recurring_todos_builder_test.rb
index a5771f86..66d06c50 100644
--- a/test/models/recurring_todos/recurring_todos_builder_test.rb
+++ b/test/models/recurring_todos/recurring_todos_builder_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/weekly_recurring_todos_builder_test.rb b/test/models/recurring_todos/weekly_recurring_todos_builder_test.rb
index 963e9b37..284fd653 100644
--- a/test/models/recurring_todos/weekly_recurring_todos_builder_test.rb
+++ b/test/models/recurring_todos/weekly_recurring_todos_builder_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/weekly_repeat_pattern_test.rb b/test/models/recurring_todos/weekly_repeat_pattern_test.rb
index 87f87397..03983089 100644
--- a/test/models/recurring_todos/weekly_repeat_pattern_test.rb
+++ b/test/models/recurring_todos/weekly_repeat_pattern_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/yearly_recurring_todos_builder_test.rb b/test/models/recurring_todos/yearly_recurring_todos_builder_test.rb
index 51db4860..807b65ef 100644
--- a/test/models/recurring_todos/yearly_recurring_todos_builder_test.rb
+++ b/test/models/recurring_todos/yearly_recurring_todos_builder_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/recurring_todos/yearly_repeat_pattern_test.rb b/test/models/recurring_todos/yearly_repeat_pattern_test.rb
index 0514e655..7030ebf8 100644
--- a/test/models/recurring_todos/yearly_repeat_pattern_test.rb
+++ b/test/models/recurring_todos/yearly_repeat_pattern_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module RecurringTodos
diff --git a/test/models/rich_message_extractor_test.rb b/test/models/rich_message_extractor_test.rb
index c2e2dba1..cecdbdcd 100644
--- a/test/models/rich_message_extractor_test.rb
+++ b/test/models/rich_message_extractor_test.rb
@@ -1,9 +1,8 @@
require 'date'
-require 'test/unit'
require 'active_support/core_ext/object/blank'
require_relative '../../app/services/rich_message_extractor.rb'
-class RichMessageExtractorTest < Test::Unit::TestCase
+class RichMessageExtractorTest < Minitest::Test
def test_message_with_all_options
message = "ohai@some-context~this-project>131012<131014#tag1#tag2*"
diff --git a/test/models/staleness_test.rb b/test/models/staleness_test.rb
index 0f119d87..daa93130 100644
--- a/test/models/staleness_test.rb
+++ b/test/models/staleness_test.rb
@@ -1,9 +1,10 @@
-require_relative '../minimal_test_helper'
+require 'minimal_test_helper'
require_relative '../../lib/staleness'
require_relative '../../lib/user_time'
-require 'timecop'
-class StalenessTest < Test::Unit::TestCase
+class StalenessTest < Minitest::Test
+ include ActiveSupport::Testing::TimeHelpers
+
FakePrefs = Struct.new(:time_zone)
FakeUser = Struct.new(:time) do
def prefs
@@ -36,11 +37,11 @@ class StalenessTest < Test::Unit::TestCase
def setup
@current_user = FakeUser.new(now)
- Timecop.freeze(Time.utc(2013,02,28))
+ travel_to Time.utc(2013,02,28)
end
def teardown
- Timecop.return
+ travel_back
end
def test_item_with_due_date_is_not_stale_ever
diff --git a/test/models/tag_cloud_query_test.rb b/test/models/tag_cloud_query_test.rb
index e0dc252e..a9bb9f22 100644
--- a/test/models/tag_cloud_query_test.rb
+++ b/test/models/tag_cloud_query_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TagCloudQueryTest < ActiveSupport::TestCase
diff --git a/test/models/tag_cloud_test.rb b/test/models/tag_cloud_test.rb
index e52f70f6..592ba47d 100644
--- a/test/models/tag_cloud_test.rb
+++ b/test/models/tag_cloud_test.rb
@@ -1,7 +1,7 @@
-require File.expand_path(File.dirname(__FILE__) + '/../minimal_test_helper')
+require 'minimal_test_helper'
require 'app/models/stats/tag_cloud'
-class TagCloudTest < Test::Unit::TestCase
+class TagCloudTest < Minitest::Test
FakeTag = Struct.new(:name, :count)
diff --git a/test/models/tag_test.rb b/test/models/tag_test.rb
index 556f6554..b070554c 100644
--- a/test/models/tag_test.rb
+++ b/test/models/tag_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TagTest < ActiveSupport::TestCase
fixtures :tags
diff --git a/test/models/tagging_test.rb b/test/models/tagging_test.rb
index 7b6c7bd9..b832d09e 100644
--- a/test/models/tagging_test.rb
+++ b/test/models/tagging_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TaggingTest < ActiveSupport::TestCase
fixtures :taggings, :tags
diff --git a/test/models/time_to_complete_test.rb b/test/models/time_to_complete_test.rb
index c4353736..ea83d487 100644
--- a/test/models/time_to_complete_test.rb
+++ b/test/models/time_to_complete_test.rb
@@ -1,11 +1,11 @@
require 'date'
require 'time'
-require './test/minimal_test_helper'
+require 'minimal_test_helper'
require 'app/models/stats/time_to_complete'
FakeTask = Struct.new(:created_at, :completed_at)
-class TimeToCompleteTest < Test::Unit::TestCase
+class TimeToCompleteTest < Minitest::Test
def now
@now ||= Time.utc(2013, 1, 2, 3, 4, 5)
diff --git a/test/models/todo_create_params_helper_test.rb b/test/models/todo_create_params_helper_test.rb
index eb9b37d9..61326598 100644
--- a/test/models/todo_create_params_helper_test.rb
+++ b/test/models/todo_create_params_helper_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
require 'todos_controller'
class TodoCreateParamsHelperTest < ActiveSupport::TestCase
diff --git a/test/models/todo_from_rich_message_test.rb b/test/models/todo_from_rich_message_test.rb
index 01d9fbb6..d8935742 100644
--- a/test/models/todo_from_rich_message_test.rb
+++ b/test/models/todo_from_rich_message_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TodoFromRichMessageTest < ActiveSupport::TestCase
diff --git a/test/models/todo_test.rb b/test/models/todo_test.rb
index 100a86a6..72e19cb0 100644
--- a/test/models/todo_test.rb
+++ b/test/models/todo_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require 'test_helper'
class TodoTest < ActiveSupport::TestCase
fixtures :todos, :recurring_todos, :users, :contexts, :preferences, :tags, :taggings, :projects
@@ -9,6 +9,10 @@ class TodoTest < ActiveSupport::TestCase
@completed = Todo.find(8).reload
end
+ def next_week
+ 1.week.from_now.beginning_of_day.to_s(:db)
+ end
+
# Test loading a todo item
def test_load
assert_kind_of Todo, @not_completed1
@@ -165,7 +169,7 @@ class TodoTest < ActiveSupport::TestCase
dates.each do |show_from_date|
# setup test case
t = @not_completed1
- Timecop.travel(show_from_date - 1.day) do
+ travel_to show_from_date - 1.day do
t.show_from = show_from_date
t.save!
assert t.deferred?
diff --git a/test/models/todos/calendar_test.rb b/test/models/todos/calendar_test.rb
index 5148f47c..f85845e6 100644
--- a/test/models/todos/calendar_test.rb
+++ b/test/models/todos/calendar_test.rb
@@ -1,4 +1,4 @@
-require_relative '../../test_helper'
+require 'test_helper'
module Todos
class CalendarTest < ActiveSupport::TestCase
@@ -34,7 +34,7 @@ module Todos
def test_due_this_month_at_start_month
# should return 1 todo
- Timecop.travel(2013,9,1) do
+ travel_to Time.zone.local(2013,9,1) do
due_this_month = create_todo(Time.zone.now.end_of_month)
assert_equal [due_this_month], @calendar.due_this_month
end
@@ -43,7 +43,7 @@ module Todos
def test_due_this_month_at_end_month
# the todo is due next week and is thus left out for todos due rest
# of month (i.e. after next week, but in this month)
- Timecop.travel(2013,9,23) do
+ travel_to Time.zone.local(2013,9,23) do
due_this_month = create_todo(Time.zone.now.end_of_month)
assert_equal 0, @calendar.due_this_month.size
end
diff --git a/test/models/todos/done_todos_test.rb b/test/models/todos/done_todos_test.rb
index b3b066e4..68917e91 100644
--- a/test/models/todos/done_todos_test.rb
+++ b/test/models/todos/done_todos_test.rb
@@ -1,10 +1,10 @@
-require_relative '../../test_helper'
+require 'test_helper'
module Todos
class DoneTodosTest < ActiveSupport::TestCase
def test_completed_period
- Timecop.travel(2013,1,23,12,00,00) do # wednesday at 12:00;
+ travel_to Time.zone.local(2013,1,23,12,00,00) do # wednesday at 12:00;
assert_equal "today", DoneTodos.completed_period(Time.zone.local(2013,1,23,9,00)) # today at 9:00
assert_equal "rest_of_week", DoneTodos.completed_period(Time.zone.local(2013,1,21)) # monday this week
assert_equal "rest_of_month", DoneTodos.completed_period(Time.zone.local(2013,1,8)) # tuestday in first week of jan
@@ -30,13 +30,13 @@ module Todos
todos = users(:admin_user).todos
# When I mark a todo complete on jan 1
- Timecop.travel(2013,1,1,0,0) do
+ travel_to Time.zone.local(2013,1,1,0,0) do
t = users(:admin_user).todos.active.first
t.complete!
end
# Then I should be in rest_of_week on jan 2
- Timecop.travel(2013,1,2,0,0) do
+ travel_to Time.zone.local(2013,1,2,0,0) do
assert 0, DoneTodos.done_today(todos.reload, {}).count
assert 1, DoneTodos.done_rest_of_week(todos.reload, {}).count
end
@@ -46,13 +46,13 @@ module Todos
todos = users(:admin_user).todos
# When I mark a todo complete on jan 1
- Timecop.travel(2013,1,1,0,0) do
+ travel_to Time.zone.local(2013,1,1,0,0) do
t = users(:admin_user).todos.active.first
t.complete!
end
# Then I should be in rest_of_month on jan 21
- Timecop.travel(2013,1,21,0,0) do
+ travel_to Time.zone.local(2013,1,21,0,0) do
assert 0, DoneTodos.done_today(todos.reload, {}).count
assert 0, DoneTodos.done_rest_of_week(todos.reload, {}).count
assert 1, DoneTodos.done_rest_of_month(todos.reload, {}).count
diff --git a/test/models/tracks_cli/tracks_api_test.rb b/test/models/tracks_cli/tracks_api_test.rb
index d1b1de2d..a1504c58 100644
--- a/test/models/tracks_cli/tracks_api_test.rb
+++ b/test/models/tracks_cli/tracks_api_test.rb
@@ -1,10 +1,10 @@
require 'net/https'
-require './test/minimal_test_helper'
+require 'minimal_test_helper'
require './doc/tracks_cli/tracks_api'
module TracksCli
- class TracksApiTest < Test::Unit::TestCase
+ class TracksApiTest < Minitest::Test
def test_https_detection
uri = URI.parse("https://tracks.example.com")
diff --git a/test/models/tracks_cli/tracks_xml_builder_test.rb b/test/models/tracks_cli/tracks_xml_builder_test.rb
index 8ef09baf..4e9eae0f 100644
--- a/test/models/tracks_cli/tracks_xml_builder_test.rb
+++ b/test/models/tracks_cli/tracks_xml_builder_test.rb
@@ -1,10 +1,10 @@
-require './test/minimal_test_helper'
+require 'minimal_test_helper'
require './doc/tracks_cli/tracks_xml_builder'
require 'active_support/time_with_zone'
module TracksCli
- class TracksXmlBuilderTest < Test::Unit::TestCase
+ class TracksXmlBuilderTest < Minitest::Test
def test_all
todo = {
description: "test action",
diff --git a/test/models/user_test.rb b/test/models/user_test.rb
index e308f84e..47763fbf 100644
--- a/test/models/user_test.rb
+++ b/test/models/user_test.rb
@@ -1,5 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
-require 'timecop'
+require 'test_helper'
class UserTest < ActiveSupport::TestCase
fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos
@@ -351,7 +350,7 @@ class UserTest < ActiveSupport::TestCase
assert_nil u.remember_token_expires_at
# set token on 2013-feb-28
- Timecop.travel(Time.local(2013, 2, 28)) do
+ travel_to Time.local(2013, 2, 28) do
u.remember_me
assert_not_nil u.remember_token_expires_at
@@ -359,12 +358,12 @@ class UserTest < ActiveSupport::TestCase
end
# token should be valid after 5 days
- Timecop.travel(Time.local(2013, 3, 5)) do
+ travel_to Time.local(2013, 3, 5) do
assert u.remember_token?
end
# token should not be valid after more than 2 weeks
- Timecop.travel(Time.local(2013, 3, 28)) do
+ travel_to Time.local(2013, 3, 28) do
assert !u.remember_token?
end
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 19c74096..6e7a07e6 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,5 +1,4 @@
ENV["RAILS_ENV"] ||= "test"
-
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
@@ -8,7 +7,7 @@ require 'rails/test_help'
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting