Merged r10948 into 2.2-stable (#3447).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.2-stable@10952 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-12-08 08:41:59 +00:00
parent daa77f0109
commit 3a379ce4b9
12 changed files with 124 additions and 24 deletions
+12 -1
View File
@@ -422,7 +422,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'text/csv; header=present', @response.content_type
assert @response.body.starts_with?("#,")
lines = @response.body.chomp.split("\n")
assert_equal assigns(:query).available_columns.size + 1, lines[0].split(',').size
assert_equal assigns(:query).available_inline_columns.size + 1, lines[0].split(',').size
end
def test_index_csv_with_multi_column_field
@@ -829,6 +829,17 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'application/pdf', response.content_type
end
def test_index_with_description_column
get :index, :set_filter => 1, :c => %w(subject description)
assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject
assert_select 'td.description[colspan=3]', :text => 'Unable to print recipes'
get :index, :set_filter => 1, :c => %w(subject description), :format => 'pdf'
assert_response :success
assert_equal 'application/pdf', response.content_type
end
def test_index_send_html_if_query_is_invalid
get :index, :f => ['start_date'], :op => {:start_date => '='}
assert_equal 'text/html', @response.content_type
+18 -1
View File
@@ -737,7 +737,9 @@ class QueryTest < ActiveSupport::TestCase
def test_default_columns
q = Query.new
assert !q.columns.empty?
assert q.columns.any?
assert q.inline_columns.any?
assert q.block_columns.empty?
end
def test_set_column_names
@@ -748,6 +750,21 @@ class QueryTest < ActiveSupport::TestCase
assert q.has_column?(c)
end
def test_inline_and_block_columns
q = Query.new
q.column_names = ['subject', 'description', 'tracker']
assert_equal [:subject, :tracker], q.inline_columns.map(&:name)
assert_equal [:description], q.block_columns.map(&:name)
end
def test_custom_field_columns_should_be_inline
q = Query.new
columns = q.available_columns.select {|column| column.is_a? QueryCustomFieldColumn}
assert columns.any?
assert_nil columns.detect {|column| !column.inline?}
end
def test_query_should_preload_spent_hours
q = Query.new(:name => '_', :column_names => [:subject, :spent_hours])
assert q.has_column?(:spent_hours)