mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Remove trailing whitespaces from test (#31506).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18233 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7ba7a19cf6
commit
adebf4da1d
@ -170,7 +170,7 @@ class AccountControllerOpenidTest < Redmine::ControllerTest
|
|||||||
:lastname => 'User',
|
:lastname => 'User',
|
||||||
:mail => 'user@somedomain.com',
|
:mail => 'user@somedomain.com',
|
||||||
:identity_url => 'http://openid.example.com/good_blank_user'
|
:identity_url => 'http://openid.example.com/good_blank_user'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
|
|||||||
@ -312,7 +312,7 @@ class AccountControllerTest < Redmine::ControllerTest
|
|||||||
:firstname => 'John',
|
:firstname => 'John',
|
||||||
:lastname => 'Doe',
|
:lastname => 'Doe',
|
||||||
:mail => 'register@example.com'
|
:mail => 'register@example.com'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to '/my/account'
|
assert_redirected_to '/my/account'
|
||||||
@ -326,7 +326,7 @@ class AccountControllerTest < Redmine::ControllerTest
|
|||||||
assert user.active?
|
assert user.active?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_post_register_with_registration_off_should_redirect
|
def test_post_register_with_registration_off_should_redirect
|
||||||
with_settings :self_registration => '0' do
|
with_settings :self_registration => '0' do
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
@ -338,7 +338,7 @@ class AccountControllerTest < Redmine::ControllerTest
|
|||||||
:firstname => 'John',
|
:firstname => 'John',
|
||||||
:lastname => 'Doe',
|
:lastname => 'Doe',
|
||||||
:mail => 'register@example.com'
|
:mail => 'register@example.com'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to '/'
|
assert_redirected_to '/'
|
||||||
@ -357,11 +357,11 @@ class AccountControllerTest < Redmine::ControllerTest
|
|||||||
:firstname => 'John',
|
:firstname => 'John',
|
||||||
:lastname => 'Doe',
|
:lastname => 'Doe',
|
||||||
:mail => 'register@example.com'
|
:mail => 'register@example.com'
|
||||||
|
|
||||||
},
|
},
|
||||||
:pref => {
|
:pref => {
|
||||||
:hide_mail => '1'
|
:hide_mail => '1'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class ActivitiesControllerTest < Redmine::ControllerTest
|
|||||||
:show_issues => '1'
|
:show_issues => '1'
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_select 'title', :text => /Issues/
|
assert_select 'title', :text => /Issues/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class CommentsControllerTest < Redmine::ControllerTest
|
|||||||
post :create, :params => {
|
post :create, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:comment => {
|
:comment => {
|
||||||
:comments => 'This is a test comment'
|
:comments => 'This is a test comment'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to '/news/1'
|
assert_redirected_to '/news/1'
|
||||||
@ -48,7 +48,7 @@ class CommentsControllerTest < Redmine::ControllerTest
|
|||||||
post :create, :params => {
|
post :create, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:comment => {
|
:comment => {
|
||||||
:comments => ''
|
:comments => ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
@ -63,7 +63,7 @@ class CommentsControllerTest < Redmine::ControllerTest
|
|||||||
post :create, :params => {
|
post :create, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:comment => {
|
:comment => {
|
||||||
:comments => 'This is a test comment'
|
:comments => 'This is a test comment'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 403
|
assert_response 403
|
||||||
|
|||||||
@ -319,7 +319,7 @@ class ContextMenusControllerTest < Redmine::ControllerTest
|
|||||||
def test_time_entries_context_menu_without_edit_permission
|
def test_time_entries_context_menu_without_edit_permission
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
Role.find_by_name('Manager').remove_permission! :edit_time_entries
|
Role.find_by_name('Manager').remove_permission! :edit_time_entries
|
||||||
|
|
||||||
get :time_entries, :params => {
|
get :time_entries, :params => {
|
||||||
:ids => [1, 2]
|
:ids => [1, 2]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
|
|||||||
post :create, :params => {
|
post :create, :params => {
|
||||||
:custom_field_id => @field.id,
|
:custom_field_id => @field.id,
|
||||||
:custom_field_enumeration => {
|
:custom_field_enumeration => {
|
||||||
:name => 'Baz'
|
:name => 'Baz'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to "/custom_fields/#{@field.id}/enumerations"
|
assert_redirected_to "/custom_fields/#{@field.id}/enumerations"
|
||||||
@ -65,7 +65,7 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
|
|||||||
post :create, :params => {
|
post :create, :params => {
|
||||||
:custom_field_id => @field.id,
|
:custom_field_id => @field.id,
|
||||||
:custom_field_enumeration => {
|
:custom_field_enumeration => {
|
||||||
:name => 'Baz'
|
:name => 'Baz'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
:xhr => true
|
:xhr => true
|
||||||
@ -81,13 +81,13 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
|
|||||||
:position => "1",
|
:position => "1",
|
||||||
:name => "Baz",
|
:name => "Baz",
|
||||||
:active => "1"
|
:active => "1"
|
||||||
},
|
},
|
||||||
@foo.id.to_s => {
|
@foo.id.to_s => {
|
||||||
:position => "2",
|
:position => "2",
|
||||||
:name => "Foo",
|
:name => "Foo",
|
||||||
:active => "0"
|
:active => "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
|
|||||||
@ -193,7 +193,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
|||||||
:type => 'IssueCustomField',
|
:type => 'IssueCustomField',
|
||||||
:custom_field => {
|
:custom_field => {
|
||||||
:field_format => 'list'
|
:field_format => 'list'
|
||||||
},
|
},
|
||||||
:format => 'js'
|
:format => 'js'
|
||||||
},
|
},
|
||||||
:xhr => true
|
:xhr => true
|
||||||
@ -247,7 +247,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
|||||||
:field_format => "string",
|
:field_format => "string",
|
||||||
:is_for_all => "0",
|
:is_for_all => "0",
|
||||||
:project_ids => ["1", "3", ""]
|
:project_ids => ["1", "3", ""]
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class FilesControllerTest < Redmine::ControllerTest
|
|||||||
:version_id => '',
|
:version_id => '',
|
||||||
:attachments => {
|
:attachments => {
|
||||||
'1' => {
|
'1' => {
|
||||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
@ -111,7 +111,7 @@ class FilesControllerTest < Redmine::ControllerTest
|
|||||||
:version_id => '2',
|
:version_id => '2',
|
||||||
:attachments => {
|
:attachments => {
|
||||||
'1' => {
|
'1' => {
|
||||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
|||||||
post :create, :params => {
|
post :create, :params => {
|
||||||
:group => {
|
:group => {
|
||||||
:name => 'New group'
|
:name => 'New group'
|
||||||
},
|
},
|
||||||
:continue => 'Create and continue'
|
:continue => 'Create and continue'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 2,
|
:id => 2,
|
||||||
:issue_category => {
|
:issue_category => {
|
||||||
:name => 'Testing'
|
:name => 'Testing'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -137,7 +137,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 2,
|
:id => 2,
|
||||||
:issue_category => {
|
:issue_category => {
|
||||||
:name => ''
|
:name => ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -148,7 +148,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 97,
|
:id => 97,
|
||||||
:issue_category => {
|
:issue_category => {
|
||||||
:name => 'Testing'
|
:name => 'Testing'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 404
|
assert_response 404
|
||||||
|
|||||||
@ -32,13 +32,13 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'table.issue_statuses'
|
assert_select 'table.issue_statuses'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_by_anonymous_should_redirect_to_login_form
|
def test_index_by_anonymous_should_redirect_to_login_form
|
||||||
@request.session[:user_id] = nil
|
@request.session[:user_id] = nil
|
||||||
get :index
|
get :index
|
||||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses'
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_by_user_should_respond_with_406
|
def test_index_by_user_should_respond_with_406
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :index
|
get :index
|
||||||
|
|||||||
@ -64,12 +64,12 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => 'My notes',
|
:notes => 'My notes',
|
||||||
:lock_version => (issue.lock_version - 1)
|
:lock_version => (issue.lock_version - 1)
|
||||||
|
|
||||||
},
|
},
|
||||||
:time_entry => {
|
:time_entry => {
|
||||||
:hours => '2.5',
|
:hours => '2.5',
|
||||||
:comments => '',
|
:comments => '',
|
||||||
:activity_id => TimeEntryActivity.first.id
|
:activity_id => TimeEntryActivity.first.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -100,16 +100,16 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => 'My notes',
|
:notes => 'My notes',
|
||||||
:lock_version => (issue.lock_version - 1)
|
:lock_version => (issue.lock_version - 1)
|
||||||
|
|
||||||
},
|
},
|
||||||
:attachments => {
|
:attachments => {
|
||||||
'1' => {
|
'1' => {
|
||||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||||
},
|
},
|
||||||
:time_entry => {
|
:time_entry => {
|
||||||
:hours => '2.5',
|
:hours => '2.5',
|
||||||
:comments => '',
|
:comments => '',
|
||||||
:activity_id => TimeEntryActivity.first.id
|
:activity_id => TimeEntryActivity.first.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -133,7 +133,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => '',
|
:notes => '',
|
||||||
:lock_version => (issue.lock_version - 1)
|
:lock_version => (issue.lock_version - 1)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -153,8 +153,8 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => '',
|
:notes => '',
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
|
|
||||||
},
|
},
|
||||||
:last_journal_id => 1
|
:last_journal_id => 1
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -172,8 +172,8 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => '',
|
:notes => '',
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
|
|
||||||
},
|
},
|
||||||
:last_journal_id => ''
|
:last_journal_id => ''
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -192,7 +192,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:issue => {
|
:issue => {
|
||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
},
|
},
|
||||||
:last_journal_id => ''
|
:last_journal_id => ''
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -204,7 +204,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:issue => {
|
:issue => {
|
||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
},
|
},
|
||||||
:last_journal_id => ''
|
:last_journal_id => ''
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -221,8 +221,8 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => 'overwrite_conflict_resolution',
|
:notes => 'overwrite_conflict_resolution',
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
|
|
||||||
},
|
},
|
||||||
:conflict_resolution => 'overwrite'
|
:conflict_resolution => 'overwrite'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -245,8 +245,8 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => 'add_notes_conflict_resolution',
|
:notes => 'add_notes_conflict_resolution',
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
|
|
||||||
},
|
},
|
||||||
:conflict_resolution => 'add_notes'
|
:conflict_resolution => 'add_notes'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -271,8 +271,8 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:notes => 'add_privates_notes_conflict_resolution',
|
:notes => 'add_privates_notes_conflict_resolution',
|
||||||
:private_notes => '1',
|
:private_notes => '1',
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
|
|
||||||
},
|
},
|
||||||
:conflict_resolution => 'add_notes'
|
:conflict_resolution => 'add_notes'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -293,8 +293,8 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
:fixed_version_id => 4,
|
:fixed_version_id => 4,
|
||||||
:notes => 'add_notes_conflict_resolution',
|
:notes => 'add_notes_conflict_resolution',
|
||||||
:lock_version => 2
|
:lock_version => 2
|
||||||
|
|
||||||
},
|
},
|
||||||
:conflict_resolution => 'cancel'
|
:conflict_resolution => 'cancel'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -311,12 +311,12 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:issue => {
|
:issue => {
|
||||||
:subject => ''
|
:subject => ''
|
||||||
},
|
},
|
||||||
:time_entry => {
|
:time_entry => {
|
||||||
:hours => '2.5',
|
:hours => '2.5',
|
||||||
:comments => 'should not be added',
|
:comments => 'should not be added',
|
||||||
:activity_id => TimeEntryActivity.first.id
|
:activity_id => TimeEntryActivity.first.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@ -174,8 +174,8 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
|
|||||||
:id => @issue.id,
|
:id => @issue.id,
|
||||||
:issue => {
|
:issue => {
|
||||||
:custom_field_values => {
|
:custom_field_values => {
|
||||||
@field1.id.to_s => "User#{user.id}Value0",
|
@field1.id.to_s => "User#{user.id}Value0",
|
||||||
@field2.id.to_s => "User#{user.id}Value1",
|
@field2.id.to_s => "User#{user.id}Value1",
|
||||||
@field3.id.to_s => "User#{user.id}Value2",
|
@field3.id.to_s => "User#{user.id}Value2",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,9 +281,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
|
|||||||
:priority_id => 5,
|
:priority_id => 5,
|
||||||
:custom_field_values => {
|
:custom_field_values => {
|
||||||
@field1.id.to_s => 'Value0', @field2.id.to_s => 'Value1', @field3.id.to_s => 'Value2'
|
@field1.id.to_s => 'Value0', @field2.id.to_s => 'Value1', @field3.id.to_s => 'Value2'
|
||||||
},
|
},
|
||||||
:watcher_user_ids => users_to_test.keys.map(&:id)
|
:watcher_user_ids => users_to_test.keys.map(&:id)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
@ -321,8 +321,8 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
|
|||||||
:issue => {
|
:issue => {
|
||||||
:custom_field_values => {
|
:custom_field_values => {
|
||||||
@field1.id.to_s => 'NewValue0', @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
|
@field1.id.to_s => 'NewValue0', @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
@ -358,8 +358,8 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
|
|||||||
:issue => {
|
:issue => {
|
||||||
:custom_field_values => {
|
:custom_field_values => {
|
||||||
@field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
|
@field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
|
|||||||
@ -118,7 +118,7 @@ class NewsControllerTest < Redmine::ControllerTest
|
|||||||
:news => {
|
:news => {
|
||||||
:title => 'NewsControllerTest',
|
:title => 'NewsControllerTest',
|
||||||
:description => 'This is the description',
|
:description => 'This is the description',
|
||||||
:summary => ''
|
:summary => ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -141,11 +141,11 @@ class NewsControllerTest < Redmine::ControllerTest
|
|||||||
:project_id => 1,
|
:project_id => 1,
|
||||||
:news => {
|
:news => {
|
||||||
:title => 'Test',
|
:title => 'Test',
|
||||||
:description => 'This is the description'
|
:description => 'This is the description'
|
||||||
},
|
},
|
||||||
:attachments => {
|
:attachments => {
|
||||||
'1' => {
|
'1' => {
|
||||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -162,7 +162,7 @@ class NewsControllerTest < Redmine::ControllerTest
|
|||||||
:news => {
|
:news => {
|
||||||
:title => '',
|
:title => '',
|
||||||
:description => 'This is the description',
|
:description => 'This is the description',
|
||||||
:summary => ''
|
:summary => ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -183,7 +183,7 @@ class NewsControllerTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:news => {
|
:news => {
|
||||||
:description => 'Description changed by test_post_edit'
|
:description => 'Description changed by test_post_edit'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to '/news/1'
|
assert_redirected_to '/news/1'
|
||||||
@ -199,11 +199,11 @@ class NewsControllerTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:news => {
|
:news => {
|
||||||
:description => 'This is the description'
|
:description => 'This is the description'
|
||||||
},
|
},
|
||||||
:attachments => {
|
:attachments => {
|
||||||
'1' => {
|
'1' => {
|
||||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -217,7 +217,7 @@ class NewsControllerTest < Redmine::ControllerTest
|
|||||||
put :update, :params => {
|
put :update, :params => {
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:news => {
|
:news => {
|
||||||
:description => ''
|
:description => ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
|||||||
:membership => {
|
:membership => {
|
||||||
:project_ids => [3],
|
:project_ids => [3],
|
||||||
:role_ids => [2]
|
:role_ids => [2]
|
||||||
},
|
},
|
||||||
:format => 'js'
|
:format => 'js'
|
||||||
},
|
},
|
||||||
:xhr => true
|
:xhr => true
|
||||||
@ -136,7 +136,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
|||||||
:user_id => 7,
|
:user_id => 7,
|
||||||
:membership => {
|
:membership => {
|
||||||
:project_ids => [3]
|
:project_ids => [3]
|
||||||
},
|
},
|
||||||
:format => 'js'
|
:format => 'js'
|
||||||
},
|
},
|
||||||
:xhr => true
|
:xhr => true
|
||||||
@ -186,7 +186,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
|||||||
:id => 1,
|
:id => 1,
|
||||||
:membership => {
|
:membership => {
|
||||||
:role_ids => [2]
|
:role_ids => [2]
|
||||||
},
|
},
|
||||||
:format => 'js'
|
:format => 'js'
|
||||||
},
|
},
|
||||||
:xhr => true
|
:xhr => true
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
|
|||||||
assert_select 'option[value=Git]:not([selected])'
|
assert_select 'option[value=Git]:not([selected])'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_new_with_type
|
def test_get_new_with_type
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
get :new, :params => {
|
get :new, :params => {
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
|
|||||||
:is_default => '0',
|
:is_default => '0',
|
||||||
:identifier => 'test-create',
|
:identifier => 'test-create',
|
||||||
:report_last_commit => '1',
|
:report_last_commit => '1',
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -77,7 +77,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
|
|||||||
:id => repository.id,
|
:id => repository.id,
|
||||||
:repository => {
|
:repository => {
|
||||||
:report_last_commit => '0'
|
:report_last_commit => '0'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_response 302
|
assert_response 302
|
||||||
|
|||||||
@ -222,7 +222,7 @@ class RolesControllerTest < Redmine::ControllerTest
|
|||||||
def test_destroy_role_in_use
|
def test_destroy_role_in_use
|
||||||
delete :destroy, :params => {:id => 1}
|
delete :destroy, :params => {:id => 1}
|
||||||
assert_redirected_to '/roles'
|
assert_redirected_to '/roles'
|
||||||
assert_equal 'This role is in use and cannot be deleted.', flash[:error]
|
assert_equal 'This role is in use and cannot be deleted.', flash[:error]
|
||||||
assert_not_nil Role.find_by_id(1)
|
assert_not_nil Role.find_by_id(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class JournalsHelperTest < Redmine::HelperTest
|
|||||||
|
|
||||||
def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
|
def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
|
||||||
issue = Issue.generate!
|
issue = Issue.generate!
|
||||||
|
|
||||||
journal = new_record(Journal) do
|
journal = new_record(Journal) do
|
||||||
issue.init_journal(User.find(1))
|
issue.init_journal(User.find(1))
|
||||||
issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'image.png'), :author => User.find(1))
|
issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'image.png'), :author => User.find(1))
|
||||||
|
|||||||
@ -60,14 +60,14 @@ class AccountTest < Redmine::IntegrationTest
|
|||||||
assert_equal 'autologin', token.action
|
assert_equal 'autologin', token.action
|
||||||
assert_equal user.id, session[:user_id]
|
assert_equal user.id, session[:user_id]
|
||||||
assert_equal token.value, cookies['autologin']
|
assert_equal token.value, cookies['autologin']
|
||||||
|
|
||||||
# Session is cleared
|
# Session is cleared
|
||||||
reset!
|
reset!
|
||||||
User.current = nil
|
User.current = nil
|
||||||
# Clears user's last login timestamp
|
# Clears user's last login timestamp
|
||||||
user.update_attribute :last_login_on, nil
|
user.update_attribute :last_login_on, nil
|
||||||
assert_nil user.reload.last_login_on
|
assert_nil user.reload.last_login_on
|
||||||
|
|
||||||
# User comes back with user's autologin cookie
|
# User comes back with user's autologin cookie
|
||||||
cookies[:autologin] = token.value
|
cookies[:autologin] = token.value
|
||||||
get '/my/page'
|
get '/my/page'
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class AdminTest < Redmine::IntegrationTest
|
|||||||
put "/users/#{user.id}", :params => {
|
put "/users/#{user.id}", :params => {
|
||||||
:id => user.id,
|
:id => user.id,
|
||||||
:user => {
|
:user => {
|
||||||
:status => User::STATUS_LOCKED
|
:status => User::STATUS_LOCKED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to "/users/#{ user.id }/edit"
|
assert_redirected_to "/users/#{ user.id }/edit"
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base
|
|||||||
assert_equal '', @response.body
|
assert_equal '', @response.body
|
||||||
assert_nil IssueCategory.find_by_id(1)
|
assert_nil IssueCategory.find_by_id(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "DELETE /issue_categories/:id.xml should reassign issues with :reassign_to_id param" do
|
test "DELETE /issue_categories/:id.xml should reassign issues with :reassign_to_id param" do
|
||||||
issue_count = Issue.where(:category_id => 1).count
|
issue_count = Issue.where(:category_id => 1).count
|
||||||
assert issue_count > 0
|
assert issue_count > 0
|
||||||
|
|||||||
@ -91,7 +91,7 @@ class Redmine::ApiTest::SearchTest < Redmine::ApiTest::Base
|
|||||||
assert_equal 4, json['limit']
|
assert_equal 4, json['limit']
|
||||||
assert_equal issue[8..10], json['results'].map {|r| r['id']}
|
assert_equal issue[8..10], json['results'].map {|r| r['id']}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /search.xml should not quick jump to the issue with given id" do
|
test "GET /search.xml should not quick jump to the issue with given id" do
|
||||||
get '/search.xml', :params => {:q => '3'}
|
get '/search.xml', :params => {:q => '3'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@ -130,7 +130,7 @@ class IssuesTest < Redmine::IntegrationTest
|
|||||||
get '/projects/ecookbook/issues?set_filter=1&group_by=fixed_version&sort=priority:desc,fixed_version,id'
|
get '/projects/ecookbook/issues?set_filter=1&group_by=fixed_version&sort=priority:desc,fixed_version,id'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'td.id', :text => '5'
|
assert_select 'td.id', :text => '5'
|
||||||
|
|
||||||
get '/issues/5'
|
get '/issues/5'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select '.next-prev-links .position', :text => '5 of 6'
|
assert_select '.next-prev-links .position', :text => '5 of 6'
|
||||||
@ -142,7 +142,7 @@ class IssuesTest < Redmine::IntegrationTest
|
|||||||
get '/projects/ecookbook/issues?set_filter=1&tracker_id=1'
|
get '/projects/ecookbook/issues?set_filter=1&tracker_id=1'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'td.id', :text => '5'
|
assert_select 'td.id', :text => '5'
|
||||||
|
|
||||||
get '/issues/5'
|
get '/issues/5'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select '.next-prev-links .position', :text => '3 of 5'
|
assert_select '.next-prev-links .position', :text => '3 of 5'
|
||||||
@ -160,7 +160,7 @@ class IssuesTest < Redmine::IntegrationTest
|
|||||||
get "/projects/ecookbook/issues?set_filter=1&query_id=#{query.id}"
|
get "/projects/ecookbook/issues?set_filter=1&query_id=#{query.id}"
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'td.id', :text => '5'
|
assert_select 'td.id', :text => '5'
|
||||||
|
|
||||||
get '/issues/5'
|
get '/issues/5'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select '.next-prev-links .position', :text => '6 of 8'
|
assert_select '.next-prev-links .position', :text => '6 of 8'
|
||||||
|
|||||||
@ -186,7 +186,7 @@ class SudoModeTest < Redmine::IntegrationTest
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
:headers => credentials('admin')
|
:headers => credentials('admin')
|
||||||
|
|
||||||
assert_response :created
|
assert_response :created
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class IssuesTest < ApplicationSystemTestCase
|
|||||||
# check issue attributes
|
# check issue attributes
|
||||||
assert_equal 'jsmith', issue.author.login
|
assert_equal 'jsmith', issue.author.login
|
||||||
assert_equal 1, issue.project.id
|
assert_equal 1, issue.project.id
|
||||||
assert_equal IssueStatus.find_by_name('New'), issue.status
|
assert_equal IssueStatus.find_by_name('New'), issue.status
|
||||||
assert_equal Tracker.find_by_name('Bug'), issue.tracker
|
assert_equal Tracker.find_by_name('Bug'), issue.tracker
|
||||||
assert_equal IssuePriority.find_by_name('Low'), issue.priority
|
assert_equal IssuePriority.find_by_name('Low'), issue.priority
|
||||||
assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
|
assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
|
||||||
@ -291,9 +291,9 @@ class IssuesTest < ApplicationSystemTestCase
|
|||||||
# Check that the page shows the Estimated hours total
|
# Check that the page shows the Estimated hours total
|
||||||
assert page.has_css?('p.query-totals')
|
assert page.has_css?('p.query-totals')
|
||||||
assert page.has_css?('span.total-for-estimated-hours')
|
assert page.has_css?('span.total-for-estimated-hours')
|
||||||
# Open the Options of the form (necessary for having the totalable columns options clickable)
|
# Open the Options of the form (necessary for having the totalable columns options clickable)
|
||||||
page.all('legend')[1].click
|
page.all('legend')[1].click
|
||||||
# Deselect the default totalable column (none should be left)
|
# Deselect the default totalable column (none should be left)
|
||||||
page.first('input[name="t[]"][value="estimated_hours"]').click
|
page.first('input[name="t[]"][value="estimated_hours"]').click
|
||||||
within('#query_form') do
|
within('#query_form') do
|
||||||
click_link 'Apply'
|
click_link 'Apply'
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class SudoModeTest < ApplicationSystemTestCase
|
|||||||
def test_add_user
|
def test_add_user
|
||||||
log_user('admin', 'admin')
|
log_user('admin', 'admin')
|
||||||
expire_sudo_mode!
|
expire_sudo_mode!
|
||||||
|
|
||||||
visit '/users/new'
|
visit '/users/new'
|
||||||
|
|
||||||
assert_difference 'User.count' do
|
assert_difference 'User.count' do
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class Redmine::CipheringTest < ActiveSupport::TestCase
|
|||||||
assert_equal 'clear', r.password
|
assert_equal 'clear', r.password
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ciphered_password_with_no_cipher_key_configured_should_be_returned_ciphered
|
def test_ciphered_password_with_no_cipher_key_configured_should_be_returned_ciphered
|
||||||
Redmine::Configuration.with 'database_cipher_key' => 'secret' do
|
Redmine::Configuration.with 'database_cipher_key' => 'secret' do
|
||||||
r = Repository::Subversion.create!(:password => 'clear', :url => 'file:///tmp', :identifier => 'svn')
|
r = Repository::Subversion.create!(:password => 'clear', :url => 'file:///tmp', :identifier => 'svn')
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class Redmine::VersionFieldFormatTest < ActionView::TestCase
|
|||||||
|
|
||||||
assert_equal expected, field.possible_values_options(project).map(&:first)
|
assert_equal expected, field.possible_values_options(project).map(&:first)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_possible_values_options_should_return_system_shared_versions_without_project
|
def test_possible_values_options_should_return_system_shared_versions_without_project
|
||||||
field = IssueCustomField.new(:field_format => 'version')
|
field = IssueCustomField.new(:field_format => 'version')
|
||||||
version = Version.generate!(:project => Project.find(1), :status => 'open', :sharing => 'system')
|
version = Version.generate!(:project => Project.find(1), :status => 'open', :sharing => 'system')
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class Redmine::I18nTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
assert l('date.day_names').is_a?(Array)
|
assert l('date.day_names').is_a?(Array)
|
||||||
assert_equal 7, l('date.day_names').size
|
assert_equal 7, l('date.day_names').size
|
||||||
|
|
||||||
assert l('date.month_names').is_a?(Array)
|
assert l('date.month_names').is_a?(Array)
|
||||||
assert_equal 13, l('date.month_names').size
|
assert_equal 13, l('date.month_names').size
|
||||||
end
|
end
|
||||||
|
|||||||
@ -211,7 +211,7 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_render_empty_virtual_menu_node_with_children
|
def test_render_empty_virtual_menu_node_with_children
|
||||||
|
|
||||||
# only empty item with no click target
|
# only empty item with no click target
|
||||||
|
|||||||
@ -77,22 +77,22 @@ class GitAdapterTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
assert_equal 8, brs.length
|
assert_equal 8, brs.length
|
||||||
br_issue_8857 = brs[0]
|
br_issue_8857 = brs[0]
|
||||||
assert_equal 'issue-8857', br_issue_8857.to_s
|
assert_equal 'issue-8857', br_issue_8857.to_s
|
||||||
assert_equal '2a682156a3b6e77a8bf9cd4590e8db757f3c6c78', br_issue_8857.revision
|
assert_equal '2a682156a3b6e77a8bf9cd4590e8db757f3c6c78', br_issue_8857.revision
|
||||||
assert_equal br_issue_8857.scmid, br_issue_8857.revision
|
assert_equal br_issue_8857.scmid, br_issue_8857.revision
|
||||||
assert_equal false, br_issue_8857.is_default
|
assert_equal false, br_issue_8857.is_default
|
||||||
br_latin_1_branch1 = brs[1]
|
br_latin_1_branch1 = brs[1]
|
||||||
assert_equal "latin-1-branch-#{@char_1}-01", br_latin_1_branch1.to_s
|
assert_equal "latin-1-branch-#{@char_1}-01", br_latin_1_branch1.to_s
|
||||||
assert_equal '4fc55c43bf3d3dc2efb66145365ddc17639ce81e', br_latin_1_branch1.revision
|
assert_equal '4fc55c43bf3d3dc2efb66145365ddc17639ce81e', br_latin_1_branch1.revision
|
||||||
assert_equal br_latin_1_branch1.scmid, br_latin_1_branch1.revision
|
assert_equal br_latin_1_branch1.scmid, br_latin_1_branch1.revision
|
||||||
assert_equal false, br_latin_1_branch1.is_default
|
assert_equal false, br_latin_1_branch1.is_default
|
||||||
br_latin_1_branch2 = brs[2]
|
br_latin_1_branch2 = brs[2]
|
||||||
assert_equal "latin-1-branch-#{@char_1}-02", br_latin_1_branch2.to_s
|
assert_equal "latin-1-branch-#{@char_1}-02", br_latin_1_branch2.to_s
|
||||||
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', br_latin_1_branch2.revision
|
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', br_latin_1_branch2.revision
|
||||||
assert_equal br_latin_1_branch2.scmid, br_latin_1_branch2.revision
|
assert_equal br_latin_1_branch2.scmid, br_latin_1_branch2.revision
|
||||||
assert_equal false, br_latin_1_branch2.is_default
|
assert_equal false, br_latin_1_branch2.is_default
|
||||||
br_latin_1_path = brs[3]
|
br_latin_1_path = brs[3]
|
||||||
assert_equal 'latin-1-path-encoding', br_latin_1_path.to_s
|
assert_equal 'latin-1-path-encoding', br_latin_1_path.to_s
|
||||||
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', br_latin_1_path.revision
|
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', br_latin_1_path.revision
|
||||||
assert_equal br_latin_1_path.scmid, br_latin_1_path.revision
|
assert_equal br_latin_1_path.scmid, br_latin_1_path.revision
|
||||||
assert_equal false, br_latin_1_path.is_default
|
assert_equal false, br_latin_1_path.is_default
|
||||||
|
|||||||
@ -123,13 +123,13 @@ DIFF
|
|||||||
--- file.c
|
--- file.c
|
||||||
-------------------------
|
-------------------------
|
||||||
+A line that starts with dashes:
|
+A line that starts with dashes:
|
||||||
|
|
||||||
and removed.
|
and removed.
|
||||||
|
|
||||||
@@ -23,4 +19,4 @@
|
@@ -23,4 +19,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-Another chunk of change
|
-Another chunk of change
|
||||||
+Another chunk of changes
|
+Another chunk of changes
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ DIFF
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_offset_range_japanese_4
|
def test_offset_range_japanese_4
|
||||||
# UTF-8 The 2nd byte differs.
|
# UTF-8 The 2nd byte differs.
|
||||||
with_settings :repositories_encodings => '' do
|
with_settings :repositories_encodings => '' do
|
||||||
diff = Redmine::UnifiedDiff.new(
|
diff = Redmine::UnifiedDiff.new(
|
||||||
read_diff_fixture('issue-13644-4.diff'), :type => 'sbs')
|
read_diff_fixture('issue-13644-4.diff'), :type => 'sbs')
|
||||||
@ -372,7 +372,7 @@ DIFF
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_offset_range_japanese_5
|
def test_offset_range_japanese_5
|
||||||
# UTF-8 The 2nd byte differs.
|
# UTF-8 The 2nd byte differs.
|
||||||
with_settings :repositories_encodings => '' do
|
with_settings :repositories_encodings => '' do
|
||||||
diff = Redmine::UnifiedDiff.new(
|
diff = Redmine::UnifiedDiff.new(
|
||||||
read_diff_fixture('issue-13644-5.diff'), :type => 'sbs')
|
read_diff_fixture('issue-13644-5.diff'), :type => 'sbs')
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
|
|||||||
|
|
||||||
def test_multiple_macros_on_the_same_line
|
def test_multiple_macros_on_the_same_line
|
||||||
Redmine::WikiFormatting::Macros.macro :foo do |obj, args|
|
Redmine::WikiFormatting::Macros.macro :foo do |obj, args|
|
||||||
args.any? ? "args: #{args.join(',')}" : "no args"
|
args.any? ? "args: #{args.join(',')}" : "no args"
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal '<p>no args no args</p>', textilizable("{{foo}} {{foo}}")
|
assert_equal '<p>no args no args</p>', textilizable("{{foo}} {{foo}}")
|
||||||
@ -212,7 +212,7 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
|
|||||||
text = "{{collapse\n*Collapsed* block of text\n}}"
|
text = "{{collapse\n*Collapsed* block of text\n}}"
|
||||||
with_locale 'en' do
|
with_locale 'en' do
|
||||||
result = textilizable(text)
|
result = textilizable(text)
|
||||||
|
|
||||||
assert_select_in result, 'div.collapsed-text'
|
assert_select_in result, 'div.collapsed-text'
|
||||||
assert_select_in result, 'strong', :text => 'Collapsed'
|
assert_select_in result, 'strong', :text => 'Collapsed'
|
||||||
assert_select_in result, 'a.collapsible.collapsed', :text => 'Show'
|
assert_select_in result, 'a.collapsible.collapsed', :text => 'Show'
|
||||||
@ -249,7 +249,7 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
|
|||||||
h1. Title
|
h1. Title
|
||||||
|
|
||||||
{{collapse(Show example, Hide example)
|
{{collapse(Show example, Hide example)
|
||||||
h2. Heading
|
h2. Heading
|
||||||
}}"
|
}}"
|
||||||
RAW
|
RAW
|
||||||
|
|
||||||
|
|||||||
@ -281,7 +281,7 @@ EXPECTED
|
|||||||
This is a table with trailing whitespace in one row:
|
This is a table with trailing whitespace in one row:
|
||||||
|
|
||||||
|cell11|cell12|
|
|cell11|cell12|
|
||||||
|cell21|cell22|
|
|cell21|cell22|
|
||||||
|cell31|cell32|
|
|cell31|cell32|
|
||||||
RAW
|
RAW
|
||||||
|
|
||||||
@ -383,8 +383,8 @@ EXPECTED
|
|||||||
expected = '<p><img src="/images/comment.png"onclick=&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x27;&#x58;&#x53;&#x53;&#x27;&#x29;;&#x22;" alt="" /></p>'
|
expected = '<p><img src="/images/comment.png"onclick=&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x27;&#x58;&#x53;&#x53;&#x27;&#x29;;&#x22;" alt="" /></p>'
|
||||||
assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
|
assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
STR_WITHOUT_PRE = [
|
STR_WITHOUT_PRE = [
|
||||||
# 0
|
# 0
|
||||||
"h1. Title
|
"h1. Title
|
||||||
@ -414,36 +414,36 @@ Praesent eget turpis nibh, a lacinia nulla.",
|
|||||||
Ut rhoncus elementum adipiscing."]
|
Ut rhoncus elementum adipiscing."]
|
||||||
|
|
||||||
TEXT_WITHOUT_PRE = STR_WITHOUT_PRE.join("\n\n").freeze
|
TEXT_WITHOUT_PRE = STR_WITHOUT_PRE.join("\n\n").freeze
|
||||||
|
|
||||||
def test_get_section_should_return_the_requested_section_and_its_hash
|
def test_get_section_should_return_the_requested_section_and_its_hash
|
||||||
assert_section_with_hash STR_WITHOUT_PRE[1], TEXT_WITHOUT_PRE, 2
|
assert_section_with_hash STR_WITHOUT_PRE[1], TEXT_WITHOUT_PRE, 2
|
||||||
assert_section_with_hash STR_WITHOUT_PRE[2..3].join("\n\n"), TEXT_WITHOUT_PRE, 3
|
assert_section_with_hash STR_WITHOUT_PRE[2..3].join("\n\n"), TEXT_WITHOUT_PRE, 3
|
||||||
assert_section_with_hash STR_WITHOUT_PRE[3], TEXT_WITHOUT_PRE, 5
|
assert_section_with_hash STR_WITHOUT_PRE[3], TEXT_WITHOUT_PRE, 5
|
||||||
assert_section_with_hash STR_WITHOUT_PRE[4], TEXT_WITHOUT_PRE, 6
|
assert_section_with_hash STR_WITHOUT_PRE[4], TEXT_WITHOUT_PRE, 6
|
||||||
|
|
||||||
assert_section_with_hash '', TEXT_WITHOUT_PRE, 0
|
assert_section_with_hash '', TEXT_WITHOUT_PRE, 0
|
||||||
assert_section_with_hash '', TEXT_WITHOUT_PRE, 10
|
assert_section_with_hash '', TEXT_WITHOUT_PRE, 10
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update_section_should_update_the_requested_section
|
def test_update_section_should_update_the_requested_section
|
||||||
replacement = "New text"
|
replacement = "New text"
|
||||||
|
|
||||||
assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement)
|
assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement)
|
||||||
assert_equal [STR_WITHOUT_PRE[0..1], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(3, replacement)
|
assert_equal [STR_WITHOUT_PRE[0..1], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(3, replacement)
|
||||||
assert_equal [STR_WITHOUT_PRE[0..2], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(5, replacement)
|
assert_equal [STR_WITHOUT_PRE[0..2], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(5, replacement)
|
||||||
assert_equal [STR_WITHOUT_PRE[0..3], replacement].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(6, replacement)
|
assert_equal [STR_WITHOUT_PRE[0..3], replacement].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(6, replacement)
|
||||||
|
|
||||||
assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(0, replacement)
|
assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(0, replacement)
|
||||||
assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(10, replacement)
|
assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(10, replacement)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update_section_with_hash_should_update_the_requested_section
|
def test_update_section_with_hash_should_update_the_requested_section
|
||||||
replacement = "New text"
|
replacement = "New text"
|
||||||
|
|
||||||
assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"),
|
assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"),
|
||||||
@formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement, Digest::MD5.hexdigest(STR_WITHOUT_PRE[1]))
|
@formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement, Digest::MD5.hexdigest(STR_WITHOUT_PRE[1]))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update_section_with_wrong_hash_should_raise_an_error
|
def test_update_section_with_wrong_hash_should_raise_an_error
|
||||||
assert_raise Redmine::WikiFormatting::StaleSectionError do
|
assert_raise Redmine::WikiFormatting::StaleSectionError do
|
||||||
@formatter.new(TEXT_WITHOUT_PRE).update_section(2, "New text", Digest::MD5.hexdigest("Old text"))
|
@formatter.new(TEXT_WITHOUT_PRE).update_section(2, "New text", Digest::MD5.hexdigest("Old text"))
|
||||||
@ -494,7 +494,7 @@ Nulla nunc nisi, egestas in ornare vel, posuere ac libero."]
|
|||||||
def test_update_section_should_not_escape_pre_content_outside_section
|
def test_update_section_should_not_escape_pre_content_outside_section
|
||||||
text = STR_WITH_PRE.join("\n\n")
|
text = STR_WITH_PRE.join("\n\n")
|
||||||
replacement = "New text"
|
replacement = "New text"
|
||||||
|
|
||||||
assert_equal [STR_WITH_PRE[0..1], "New text"].flatten.join("\n\n"),
|
assert_equal [STR_WITH_PRE[0..1], "New text"].flatten.join("\n\n"),
|
||||||
@formatter.new(text).update_section(3, replacement)
|
@formatter.new(text).update_section(3, replacement)
|
||||||
end
|
end
|
||||||
@ -509,13 +509,13 @@ Content 1
|
|||||||
h1. Heading 2
|
h1. Heading 2
|
||||||
|
|
||||||
Content 2
|
Content 2
|
||||||
|
|
||||||
h1. Heading 3
|
h1. Heading 3
|
||||||
|
|
||||||
Content 3
|
Content 3
|
||||||
|
|
||||||
h1. Heading 4
|
h1. Heading 4
|
||||||
|
|
||||||
Content 4
|
Content 4
|
||||||
STR
|
STR
|
||||||
|
|
||||||
@ -633,10 +633,10 @@ EXPECTED
|
|||||||
def to_html(text)
|
def to_html(text)
|
||||||
@formatter.new(text).to_html
|
@formatter.new(text).to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_section_with_hash(expected, text, index)
|
def assert_section_with_hash(expected, text, index)
|
||||||
result = @formatter.new(text).get_section(index)
|
result = @formatter.new(text).get_section(index)
|
||||||
|
|
||||||
assert_kind_of Array, result
|
assert_kind_of Array, result
|
||||||
assert_equal 2, result.size
|
assert_equal 2, result.size
|
||||||
assert_equal expected, result.first, "section content did not match"
|
assert_equal expected, result.first, "section content did not match"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user