diff --git a/Gemfile b/Gemfile index 6e9e672a..8d87f436 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ 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' +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' diff --git a/Gemfile.lock b/Gemfile.lock index 918ab9fb..98c3355b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,35 +19,37 @@ GEM specs: RedCloth (4.2.9) aasm (3.1.1) - actionmailer (4.0.5) - actionpack (= 4.0.5) + actionmailer (4.1.1) + actionpack (= 4.1.1) + actionview (= 4.1.1) mail (~> 2.5.4) - actionpack (4.0.5) - activesupport (= 4.0.5) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionpack (4.1.1) + actionview (= 4.1.1) + activesupport (= 4.1.1) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.5) - activesupport (= 4.0.5) - builder (~> 3.1.0) - activerecord (4.0.5) - activemodel (= 4.0.5) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.5) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.5) + actionview (4.1.1) + activesupport (= 4.1.1) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.1) + activesupport (= 4.1.1) + builder (~> 3.1) + activerecord (4.1.1) + activemodel (= 4.1.1) + activesupport (= 4.1.1) + arel (~> 5.0.0) + activesupport (4.1.1) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) acts_as_list (0.4.0) activerecord (>= 3.0) - arel (4.0.2) + arel (5.0.1.20140414130214) bcrypt-ruby (3.0.1) - builder (3.1.4) + builder (3.2.2) bullet (4.9.0) activesupport uniform_notifier (~> 1.6.0) @@ -71,17 +73,18 @@ GEM coffee-script-source execjs coffee-script-source (1.7.0) - cucumber (1.3.14) + cucumber (1.3.15) 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) + cucumber-rails (1.4.1) + capybara (>= 1.1.2, < 3) + cucumber (>= 1.3.8, < 2) + mime-types (~> 1.16) + nokogiri (~> 1.5) + rails (>= 3, < 5) database_cleaner (1.2.0) diff-lcs (1.2.5) docile (1.1.3) @@ -108,37 +111,39 @@ GEM 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) + mini_portile (0.6.0) + minitest (5.3.4) + mocha (1.1.0) metaclass (~> 0.0.1) multi_json (1.10.0) multi_test (0.1.1) - mysql2 (0.3.15) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + mysql2 (0.3.16) + nokogiri (1.6.2.1) + mini_portile (= 0.6.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.5) - actionmailer (= 4.0.5) - actionpack (= 4.0.5) - activerecord (= 4.0.5) - activesupport (= 4.0.5) + rails (4.1.1) + actionmailer (= 4.1.1) + actionpack (= 4.1.1) + actionview (= 4.1.1) + activemodel (= 4.1.1) + activerecord (= 4.1.1) + activesupport (= 4.1.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.5) - sprockets-rails (~> 2.0.0) + railties (= 4.1.1) + sprockets-rails (~> 2.0) rails_autolink (1.1.5) rails (> 3.1) - railties (4.0.5) - actionpack (= 4.0.5) - activesupport (= 4.0.5) + railties (4.1.1) + actionpack (= 4.1.1) + activesupport (= 4.1.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.3.1) + rake (10.3.2) ref (1.0.5) rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) @@ -167,7 +172,7 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) + sprockets-rails (2.1.3) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) @@ -188,7 +193,8 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.39) + tzinfo (1.1.0) + thread_safe (~> 0.1) uglifier (2.5.0) execjs (>= 0.3.0) json (>= 1.8.0) @@ -213,21 +219,20 @@ DEPENDENCIES cache_digests capybara codeclimate-test-reporter - coffee-rails (~> 4.0.0) + coffee-rails (~> 4.0) cucumber-rails database_cleaner factory_girl_rails htmlentities jquery-rails - json mocha mysql2 rack-mini-profiler - rails (~> 4.0.0) + rails (~> 4.1) rails_autolink rspec-expectations sanitize - sass-rails (~> 4.0.0) + sass-rails (~> 4.0) selenium-webdriver simplecov sqlite3 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/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/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/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 07455c80..a29147ce 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -238,7 +238,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) @@ -251,7 +251,7 @@ module TodosHelper if todo.completed? content_tag(:span, {:class => :grey}) { format_date( todo.completed_at ) } elsif todo.pending? - title = t('todos.depends_on')+ ": " + todo.uncompleted_predecessors.map(&:description).join(', ') + 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 ) @@ -263,7 +263,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 @@ -277,7 +277,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) diff --git a/app/models/user.rb b/app/models/user.rb index 90f59d16..4fb1ca29 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} diff --git a/app/views/todos/add_predecessor.js.erb b/app/views/todos/add_predecessor.js.erb index 98928bcc..82fa8cc6 100644 --- a/app/views/todos/add_predecessor.js.erb +++ b/app/views/todos/add_predecessor.js.erb @@ -29,7 +29,7 @@ function show_in_tickler_box() { 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/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/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 43b782df..8ce96f81 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -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?") + @project.send(state=="completed" ? "completed?" : "hidden?").should be_true end Given /^I have (\d+) completed projects$/ do |number_of_projects| diff --git a/features/view_done.feature b/features/view_done.feature index 701fb938..efb6072a 100644 --- a/features/view_done.feature +++ b/features/view_done.feature @@ -156,7 +156,7 @@ Feature: Show done @javascript @reset_time 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 2" in context "@pc" completed 2 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 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/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/pie_chart_data_test.rb b/test/models/pie_chart_data_test.rb index d5933d12..09ac2bc2 100644 --- a/test/models/pie_chart_data_test.rb +++ b/test/models/pie_chart_data_test.rb @@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../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/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..976a8861 100644 --- a/test/models/staleness_test.rb +++ b/test/models/staleness_test.rb @@ -3,7 +3,7 @@ require_relative '../../lib/staleness' require_relative '../../lib/user_time' require 'timecop' -class StalenessTest < Test::Unit::TestCase +class StalenessTest < Minitest::Test FakePrefs = Struct.new(:time_zone) FakeUser = Struct.new(:time) do def prefs diff --git a/test/models/tag_cloud_test.rb b/test/models/tag_cloud_test.rb index e52f70f6..ad46eadb 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 'app/models/stats/tag_cloud' -class TagCloudTest < Test::Unit::TestCase +class TagCloudTest < Minitest::Test FakeTag = Struct.new(:name, :count) diff --git a/test/models/time_to_complete_test.rb b/test/models/time_to_complete_test.rb index c4353736..7ab9896e 100644 --- a/test/models/time_to_complete_test.rb +++ b/test/models/time_to_complete_test.rb @@ -5,7 +5,7 @@ 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_test.rb b/test/models/todo_test.rb index 100a86a6..a6ba8c92 100644 --- a/test/models/todo_test.rb +++ b/test/models/todo_test.rb @@ -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 diff --git a/test/models/tracks_cli/tracks_api_test.rb b/test/models/tracks_cli/tracks_api_test.rb index d1b1de2d..dbe51523 100644 --- a/test/models/tracks_cli/tracks_api_test.rb +++ b/test/models/tracks_cli/tracks_api_test.rb @@ -4,7 +4,7 @@ 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..71b62571 100644 --- a/test/models/tracks_cli/tracks_xml_builder_test.rb +++ b/test/models/tracks_cli/tracks_xml_builder_test.rb @@ -4,7 +4,7 @@ require 'active_support/time_with_zone' module TracksCli - class TracksXmlBuilderTest < Test::Unit::TestCase + class TracksXmlBuilderTest < Minitest::Test def test_all todo = { description: "test action",