Merge pull request #218 from TracksApp/rails41

Rails 4.1 migration
This commit is contained in:
Reinier Balt 2014-05-16 14:42:33 +02:00
commit 4cde8ce78b
24 changed files with 90 additions and 82 deletions

View file

@ -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'

View file

@ -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

BIN
app/assets/images/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

View file

@ -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']]
)

View file

@ -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

View file

@ -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)

View file

@ -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}

View file

@ -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 -%>

View file

@ -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 -%>

View file

@ -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 -%>

View file

@ -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

View file

@ -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|

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,5 @@
ENV["RAILS_ENV"] ||= "test"
require 'test/unit'
require 'minitest/autorun'
require 'mocha/setup'
$:.unshift File.dirname(File.dirname(__FILE__))

View file

@ -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)' } }

View file

@ -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*"

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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")

View file

@ -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",