Merge branch 'master' into rails4

Conflicts:
	Gemfile.lock
	config/routes.rb
This commit is contained in:
Reinier Balt 2013-06-17 09:25:02 +02:00
commit 4a485558e2
51 changed files with 5475 additions and 5015 deletions

View file

@ -120,6 +120,28 @@ class TodosControllerTest < ActionController::TestCase
assert_response :success
assert_equal 3, @tagged
end
def test_find_tagged_with_terms_separated_with_dot
login_as :admin_user
create_todo(description: "test dotted tag", tag_list: "first.last, second")
t = assigns['todo']
assert_equal "first.last, second", t.tag_list
get :tag, name: 'first.last.m'
assert_equal "text/html", request.format, "controller should set right content type"
assert_equal "text/html", @response.content_type
assert_equal "first.last", assigns['tag_name'], ".m should be chomped"
get :tag, name: 'first.last.txt'
assert_equal "text/plain", request.format, "controller should set right content type"
assert_equal "text/plain", @response.content_type
assert_equal "first.last", assigns['tag_name'], ".txt should be chomped"
get :tag, name: 'first.last'
assert_equal "text/html", request.format, "controller should set right content type"
assert_equal "text/html", @response.content_type
assert_equal "first.last", assigns['tag_name'], ":name should be correct"
end
def test_get_boolean_expression_from_parameters_of_tag_view_single_tag
login_as(:admin_user)
@ -669,7 +691,7 @@ class TodosControllerTest < ActionController::TestCase
recurring_todo_1 = RecurringTodo.find(1)
#set_user_to_current_time_zone(recurring_todo_1.user)
todo_1 = Todo.where(:recurring_todo_id => 1).first
today = Time.zone.now.at_midnight
today = Time.zone.now.at_midnight - 1.day
# change recurrence pattern to monthly and set show_from to today
recurring_todo_1.target = 'show_from_date'
@ -708,7 +730,7 @@ class TodosControllerTest < ActionController::TestCase
assert !new_todo.show_from.nil?
# do not use today here. It somehow gets messed up with the timezone calculation.
next_month = (Time.zone.now + 1.month).at_midnight
next_month = (Time.zone.now - 1.day + 1.month).at_midnight
assert_equal next_month.utc.to_date.to_s(:db), new_todo.show_from.utc.to_date.to_s(:db)
end
@ -920,4 +942,19 @@ class TodosControllerTest < ActionController::TestCase
assert t4.pending?, "t4 should remain pending"
assert t4.predecessors.map(&:id).include?(t3.id)
end
private
def create_todo(params={})
defaults = { source_view: 'todo',
context_name: "library", project_name: "Build a working time machine",
notes: "note", description: "a new todo", due: nil, tag_list: "a,b,c"}
params=params.reverse_merge(defaults)
put :create, _source_view: params[:_source_view],
context_name: params[:context_name], project_name: params[:project_name], tag_list: params[:tag_list],
todo: {notes: params[:notes], description: params[:description], due: params[:due]}
end
end