Patch #31506 » 0004-Remove-trailing-whitespaces-from-test.patch
| test/functional/account_controller_openid_test.rb | ||
|---|---|---|
|
:lastname => 'User',
|
||
|
:mail => 'user@somedomain.com',
|
||
|
:identity_url => 'http://openid.example.com/good_blank_user'
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| test/functional/account_controller_test.rb | ||
|---|---|---|
|
:firstname => 'John',
|
||
|
:lastname => 'Doe',
|
||
|
:mail => 'register@example.com'
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_redirected_to '/my/account'
|
||
| ... | ... | |
|
assert user.active?
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_post_register_with_registration_off_should_redirect
|
||
|
with_settings :self_registration => '0' do
|
||
|
assert_no_difference 'User.count' do
|
||
| ... | ... | |
|
:firstname => 'John',
|
||
|
:lastname => 'Doe',
|
||
|
:mail => 'register@example.com'
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_redirected_to '/'
|
||
| ... | ... | |
|
:firstname => 'John',
|
||
|
:lastname => 'Doe',
|
||
|
:mail => 'register@example.com'
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:pref => {
|
||
|
:hide_mail => '1'
|
||
|
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| test/functional/activities_controller_test.rb | ||
|---|---|---|
|
:show_issues => '1'
|
||
|
}
|
||
|
assert_response :success
|
||
|
|
||
|
assert_select 'title', :text => /Issues/
|
||
|
end
|
||
|
end
|
||
| test/functional/comments_controller_test.rb | ||
|---|---|---|
|
post :create, :params => {
|
||
|
:id => 1,
|
||
|
:comment => {
|
||
|
:comments => 'This is a test comment'
|
||
|
:comments => 'This is a test comment'
|
||
|
}
|
||
|
}
|
||
|
assert_redirected_to '/news/1'
|
||
| ... | ... | |
|
post :create, :params => {
|
||
|
:id => 1,
|
||
|
:comment => {
|
||
|
:comments => ''
|
||
|
:comments => ''
|
||
|
}
|
||
|
}
|
||
|
assert_response :redirect
|
||
| ... | ... | |
|
post :create, :params => {
|
||
|
:id => 1,
|
||
|
:comment => {
|
||
|
:comments => 'This is a test comment'
|
||
|
:comments => 'This is a test comment'
|
||
|
}
|
||
|
}
|
||
|
assert_response 403
|
||
| test/functional/context_menus_controller_test.rb | ||
|---|---|---|
|
def test_time_entries_context_menu_without_edit_permission
|
||
|
@request.session[:user_id] = 2
|
||
|
Role.find_by_name('Manager').remove_permission! :edit_time_entries
|
||
|
|
||
|
get :time_entries, :params => {
|
||
|
:ids => [1, 2]
|
||
|
}
|
||
| test/functional/custom_field_enumerations_controller_test.rb | ||
|---|---|---|
|
post :create, :params => {
|
||
|
:custom_field_id => @field.id,
|
||
|
:custom_field_enumeration => {
|
||
|
:name => 'Baz'
|
||
|
:name => 'Baz'
|
||
|
}
|
||
|
}
|
||
|
assert_redirected_to "/custom_fields/#{@field.id}/enumerations"
|
||
| ... | ... | |
|
post :create, :params => {
|
||
|
:custom_field_id => @field.id,
|
||
|
:custom_field_enumeration => {
|
||
|
:name => 'Baz'
|
||
|
:name => 'Baz'
|
||
|
}
|
||
|
},
|
||
|
:xhr => true
|
||
| ... | ... | |
|
:position => "1",
|
||
|
:name => "Baz",
|
||
|
:active => "1"
|
||
|
},
|
||
|
},
|
||
|
@foo.id.to_s => {
|
||
|
:position => "2",
|
||
|
:name => "Foo",
|
||
|
:active => "0"
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| test/functional/custom_fields_controller_test.rb | ||
|---|---|---|
|
:type => 'IssueCustomField',
|
||
|
:custom_field => {
|
||
|
:field_format => 'list'
|
||
|
},
|
||
|
},
|
||
|
:format => 'js'
|
||
|
},
|
||
|
:xhr => true
|
||
| ... | ... | |
|
:field_format => "string",
|
||
|
:is_for_all => "0",
|
||
|
:project_ids => ["1", "3", ""]
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| test/functional/files_controller_test.rb | ||
|---|---|---|
|
:version_id => '',
|
||
|
:attachments => {
|
||
|
'1' => {
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
}
|
||
|
}
|
||
|
assert_response :redirect
|
||
| ... | ... | |
|
:version_id => '2',
|
||
|
:attachments => {
|
||
|
'1' => {
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
}
|
||
|
}
|
||
|
assert_response :redirect
|
||
| test/functional/groups_controller_test.rb | ||
|---|---|---|
|
post :create, :params => {
|
||
|
:group => {
|
||
|
:name => 'New group'
|
||
|
},
|
||
|
},
|
||
|
:continue => 'Create and continue'
|
||
|
}
|
||
|
end
|
||
| test/functional/issue_categories_controller_test.rb | ||
|---|---|---|
|
put :update, :params => {
|
||
|
:id => 2,
|
||
|
:issue_category => {
|
||
|
:name => 'Testing'
|
||
|
:name => 'Testing'
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
put :update, :params => {
|
||
|
:id => 2,
|
||
|
:issue_category => {
|
||
|
:name => ''
|
||
|
:name => ''
|
||
|
}
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
put :update, :params => {
|
||
|
:id => 97,
|
||
|
:issue_category => {
|
||
|
:name => 'Testing'
|
||
|
:name => 'Testing'
|
||
|
}
|
||
|
}
|
||
|
assert_response 404
|
||
| test/functional/issue_statuses_controller_test.rb | ||
|---|---|---|
|
assert_response :success
|
||
|
assert_select 'table.issue_statuses'
|
||
|
end
|
||
|
|
||
|
def test_index_by_anonymous_should_redirect_to_login_form
|
||
|
@request.session[:user_id] = nil
|
||
|
get :index
|
||
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses'
|
||
|
end
|
||
|
|
||
|
def test_index_by_user_should_respond_with_406
|
||
|
@request.session[:user_id] = 2
|
||
|
get :index
|
||
| test/functional/issues_controller_transaction_test.rb | ||
|---|---|---|
|
:fixed_version_id => 4,
|
||
|
:notes => 'My notes',
|
||
|
:lock_version => (issue.lock_version - 1)
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:time_entry => {
|
||
|
:hours => '2.5',
|
||
|
:comments => '',
|
||
|
:activity_id => TimeEntryActivity.first.id
|
||
|
:activity_id => TimeEntryActivity.first.id
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => 'My notes',
|
||
|
:lock_version => (issue.lock_version - 1)
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:attachments => {
|
||
|
'1' => {
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
},
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
},
|
||
|
:time_entry => {
|
||
|
:hours => '2.5',
|
||
|
:comments => '',
|
||
|
:activity_id => TimeEntryActivity.first.id
|
||
|
:activity_id => TimeEntryActivity.first.id
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => '',
|
||
|
:lock_version => (issue.lock_version - 1)
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => '',
|
||
|
:lock_version => 2
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:last_journal_id => 1
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => '',
|
||
|
:lock_version => 2
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:last_journal_id => ''
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
:issue => {
|
||
|
:fixed_version_id => 4,
|
||
|
:lock_version => 2
|
||
|
},
|
||
|
},
|
||
|
:last_journal_id => ''
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
:issue => {
|
||
|
:fixed_version_id => 4,
|
||
|
:lock_version => 2
|
||
|
},
|
||
|
},
|
||
|
:last_journal_id => ''
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => 'overwrite_conflict_resolution',
|
||
|
:lock_version => 2
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:conflict_resolution => 'overwrite'
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => 'add_notes_conflict_resolution',
|
||
|
:lock_version => 2
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:conflict_resolution => 'add_notes'
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:notes => 'add_privates_notes_conflict_resolution',
|
||
|
:private_notes => '1',
|
||
|
:lock_version => 2
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:conflict_resolution => 'add_notes'
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:fixed_version_id => 4,
|
||
|
:notes => 'add_notes_conflict_resolution',
|
||
|
:lock_version => 2
|
||
|
|
||
|
},
|
||
|
},
|
||
|
:conflict_resolution => 'cancel'
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
put :update, :params => {
|
||
|
:id => 1,
|
||
|
:issue => {
|
||
|
:subject => ''
|
||
|
},
|
||
|
:subject => ''
|
||
|
},
|
||
|
:time_entry => {
|
||
|
:hours => '2.5',
|
||
|
:comments => 'should not be added',
|
||
|
:activity_id => TimeEntryActivity.first.id
|
||
|
:activity_id => TimeEntryActivity.first.id
|
||
|
}
|
||
|
}
|
||
|
assert_response :success
|
||
| test/functional/issues_custom_fields_visibility_test.rb | ||
|---|---|---|
|
:id => @issue.id,
|
||
|
:issue => {
|
||
|
:custom_field_values => {
|
||
|
@field1.id.to_s => "User#{user.id}Value0",
|
||
|
@field2.id.to_s => "User#{user.id}Value1",
|
||
|
@field1.id.to_s => "User#{user.id}Value0",
|
||
|
@field2.id.to_s => "User#{user.id}Value1",
|
||
|
@field3.id.to_s => "User#{user.id}Value2",
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
:priority_id => 5,
|
||
|
:custom_field_values => {
|
||
|
@field1.id.to_s => 'Value0', @field2.id.to_s => 'Value1', @field3.id.to_s => 'Value2'
|
||
|
},
|
||
|
},
|
||
|
:watcher_user_ids => users_to_test.keys.map(&:id)
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| ... | ... | |
|
:issue => {
|
||
|
:custom_field_values => {
|
||
|
@field1.id.to_s => 'NewValue0', @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| ... | ... | |
|
:issue => {
|
||
|
:custom_field_values => {
|
||
|
@field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| test/functional/news_controller_test.rb | ||
|---|---|---|
|
:news => {
|
||
|
:title => 'NewsControllerTest',
|
||
|
:description => 'This is the description',
|
||
|
:summary => ''
|
||
|
:summary => ''
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:project_id => 1,
|
||
|
:news => {
|
||
|
:title => 'Test',
|
||
|
:description => 'This is the description'
|
||
|
},
|
||
|
:description => 'This is the description'
|
||
|
},
|
||
|
:attachments => {
|
||
|
'1' => {
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:news => {
|
||
|
:title => '',
|
||
|
:description => 'This is the description',
|
||
|
:summary => ''
|
||
|
:summary => ''
|
||
|
}
|
||
|
}
|
||
|
assert_response :success
|
||
| ... | ... | |
|
put :update, :params => {
|
||
|
:id => 1,
|
||
|
:news => {
|
||
|
:description => 'Description changed by test_post_edit'
|
||
|
:description => 'Description changed by test_post_edit'
|
||
|
}
|
||
|
}
|
||
|
assert_redirected_to '/news/1'
|
||
| ... | ... | |
|
put :update, :params => {
|
||
|
:id => 1,
|
||
|
:news => {
|
||
|
:description => 'This is the description'
|
||
|
},
|
||
|
:description => 'This is the description'
|
||
|
},
|
||
|
:attachments => {
|
||
|
'1' => {
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
put :update, :params => {
|
||
|
:id => 1,
|
||
|
:news => {
|
||
|
:description => ''
|
||
|
:description => ''
|
||
|
}
|
||
|
}
|
||
|
assert_response :success
|
||
| test/functional/principal_memberships_controller_test.rb | ||
|---|---|---|
|
:membership => {
|
||
|
:project_ids => [3],
|
||
|
:role_ids => [2]
|
||
|
},
|
||
|
},
|
||
|
:format => 'js'
|
||
|
},
|
||
|
:xhr => true
|
||
| ... | ... | |
|
:user_id => 7,
|
||
|
:membership => {
|
||
|
:project_ids => [3]
|
||
|
},
|
||
|
},
|
||
|
:format => 'js'
|
||
|
},
|
||
|
:xhr => true
|
||
| ... | ... | |
|
:id => 1,
|
||
|
:membership => {
|
||
|
:role_ids => [2]
|
||
|
},
|
||
|
},
|
||
|
:format => 'js'
|
||
|
},
|
||
|
:xhr => true
|
||
| test/functional/repositories_controller_test.rb | ||
|---|---|---|
|
assert_select 'option[value=Git]:not([selected])'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_get_new_with_type
|
||
|
@request.session[:user_id] = 1
|
||
|
get :new, :params => {
|
||
| test/functional/repositories_git_controller_test.rb | ||
|---|---|---|
|
:is_default => '0',
|
||
|
:identifier => 'test-create',
|
||
|
:report_last_commit => '1',
|
||
|
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
:id => repository.id,
|
||
|
:repository => {
|
||
|
:report_last_commit => '0'
|
||
|
|
||
|
}
|
||
|
}
|
||
|
assert_response 302
|
||
| test/functional/roles_controller_test.rb | ||
|---|---|---|
|
def test_destroy_role_in_use
|
||
|
delete :destroy, :params => {:id => 1}
|
||
|
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)
|
||
|
end
|
||
| test/helpers/journals_helper_test.rb | ||
|---|---|---|
|
def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
|
||
|
issue = Issue.generate!
|
||
|
|
||
|
journal = new_record(Journal) do
|
||
|
issue.init_journal(User.find(1))
|
||
|
issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'image.png'), :author => User.find(1))
|
||
| test/integration/account_test.rb | ||
|---|---|---|
|
assert_equal 'autologin', token.action
|
||
|
assert_equal user.id, session[:user_id]
|
||
|
assert_equal token.value, cookies['autologin']
|
||
|
|
||
|
# Session is cleared
|
||
|
reset!
|
||
|
User.current = nil
|
||
|
# Clears user's last login timestamp
|
||
|
user.update_attribute :last_login_on, nil
|
||
|
assert_nil user.reload.last_login_on
|
||
|
|
||
|
# User comes back with user's autologin cookie
|
||
|
cookies[:autologin] = token.value
|
||
|
get '/my/page'
|
||
| test/integration/admin_test.rb | ||
|---|---|---|
|
put "/users/#{user.id}", :params => {
|
||
|
:id => user.id,
|
||
|
:user => {
|
||
|
:status => User::STATUS_LOCKED
|
||
|
:status => User::STATUS_LOCKED
|
||
|
}
|
||
|
}
|
||
|
assert_redirected_to "/users/#{ user.id }/edit"
|
||
| test/integration/api_test/issue_categories_test.rb | ||
|---|---|---|
|
assert_equal '', @response.body
|
||
|
assert_nil IssueCategory.find_by_id(1)
|
||
|
end
|
||
|
|
||
|
test "DELETE /issue_categories/:id.xml should reassign issues with :reassign_to_id param" do
|
||
|
issue_count = Issue.where(:category_id => 1).count
|
||
|
assert issue_count > 0
|
||
| test/integration/api_test/search_test.rb | ||
|---|---|---|
|
assert_equal 4, json['limit']
|
||
|
assert_equal issue[8..10], json['results'].map {|r| r['id']}
|
||
|
end
|
||
|
|
||
|
test "GET /search.xml should not quick jump to the issue with given id" do
|
||
|
get '/search.xml', :params => {:q => '3'}
|
||
|
assert_response :success
|
||
| test/integration/issues_test.rb | ||
|---|---|---|
|
get '/projects/ecookbook/issues?set_filter=1&group_by=fixed_version&sort=priority:desc,fixed_version,id'
|
||
|
assert_response :success
|
||
|
assert_select 'td.id', :text => '5'
|
||
|
|
||
|
get '/issues/5'
|
||
|
assert_response :success
|
||
|
assert_select '.next-prev-links .position', :text => '5 of 6'
|
||
| ... | ... | |
|
get '/projects/ecookbook/issues?set_filter=1&tracker_id=1'
|
||
|
assert_response :success
|
||
|
assert_select 'td.id', :text => '5'
|
||
|
|
||
|
get '/issues/5'
|
||
|
assert_response :success
|
||
|
assert_select '.next-prev-links .position', :text => '3 of 5'
|
||
| ... | ... | |
|
get "/projects/ecookbook/issues?set_filter=1&query_id=#{query.id}"
|
||
|
assert_response :success
|
||
|
assert_select 'td.id', :text => '5'
|
||
|
|
||
|
get '/issues/5'
|
||
|
assert_response :success
|
||
|
assert_select '.next-prev-links .position', :text => '6 of 8'
|
||
| test/integration/sudo_mode_test.rb | ||
|---|---|---|
|
}
|
||
|
},
|
||
|
:headers => credentials('admin')
|
||
|
|
||
|
assert_response :created
|
||
|
end
|
||
|
end
|
||
| test/system/issues_test.rb | ||
|---|---|---|
|
# check issue attributes
|
||
|
assert_equal 'jsmith', issue.author.login
|
||
|
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 IssuePriority.find_by_name('Low'), issue.priority
|
||
|
assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
|
||
| ... | ... | |
|
# Check that the page shows the Estimated hours total
|
||
|
assert page.has_css?('p.query-totals')
|
||
|
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
|
||
|
# 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
|
||
|
within('#query_form') do
|
||
|
click_link 'Apply'
|
||
| test/system/sudo_mode_test.rb | ||
|---|---|---|
|
def test_add_user
|
||
|
log_user('admin', 'admin')
|
||
|
expire_sudo_mode!
|
||
|
|
||
|
visit '/users/new'
|
||
|
assert_difference 'User.count' do
|
||
| test/unit/lib/redmine/ciphering_test.rb | ||
|---|---|---|
|
assert_equal 'clear', r.password
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_ciphered_password_with_no_cipher_key_configured_should_be_returned_ciphered
|
||
|
Redmine::Configuration.with 'database_cipher_key' => 'secret' do
|
||
|
r = Repository::Subversion.create!(:password => 'clear', :url => 'file:///tmp', :identifier => 'svn')
|
||
| test/unit/lib/redmine/field_format/version_field_format_test.rb | ||
|---|---|---|
|
assert_equal expected, field.possible_values_options(project).map(&:first)
|
||
|
end
|
||
|
|
||
|
def test_possible_values_options_should_return_system_shared_versions_without_project
|
||
|
field = IssueCustomField.new(:field_format => 'version')
|
||
|
version = Version.generate!(:project => Project.find(1), :status => 'open', :sharing => 'system')
|
||
| test/unit/lib/redmine/i18n_test.rb | ||
|---|---|---|
|
end
|
||
|
assert l('date.day_names').is_a?(Array)
|
||
|
assert_equal 7, l('date.day_names').size
|
||
|
|
||
|
assert l('date.month_names').is_a?(Array)
|
||
|
assert_equal 13, l('date.month_names').size
|
||
|
end
|
||
| test/unit/lib/redmine/menu_manager/menu_helper_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_render_empty_virtual_menu_node_with_children
|
||
|
# only empty item with no click target
|
||
| test/unit/lib/redmine/scm/adapters/git_adapter_test.rb | ||
|---|---|---|
|
end
|
||
|
assert_equal 8, brs.length
|
||
|
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 br_issue_8857.scmid, br_issue_8857.revision
|
||
|
assert_equal false, br_issue_8857.is_default
|
||
|
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 br_latin_1_branch1.scmid, br_latin_1_branch1.revision
|
||
|
assert_equal false, br_latin_1_branch1.is_default
|
||
|
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 br_latin_1_branch2.scmid, br_latin_1_branch2.revision
|
||
|
assert_equal false, br_latin_1_branch2.is_default
|
||
|
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 br_latin_1_path.scmid, br_latin_1_path.revision
|
||
|
assert_equal false, br_latin_1_path.is_default
|
||
| test/unit/lib/redmine/unified_diff_test.rb | ||
|---|---|---|
|
--- file.c
|
||
|
-------------------------
|
||
|
+A line that starts with dashes:
|
||
|
|
||
|
and removed.
|
||
|
|
||
|
@@ -23,4 +19,4 @@
|
||
|
|
||
|
|
||
|
|
||
|
-Another chunk of change
|
||
|
+Another chunk of changes
|
||
| ... | ... | |
|
end
|
||
|
def test_offset_range_japanese_4
|
||
|
# UTF-8 The 2nd byte differs.
|
||
|
# UTF-8 The 2nd byte differs.
|
||
|
with_settings :repositories_encodings => '' do
|
||
|
diff = Redmine::UnifiedDiff.new(
|
||
|
read_diff_fixture('issue-13644-4.diff'), :type => 'sbs')
|
||
| ... | ... | |
|
end
|
||
|
def test_offset_range_japanese_5
|
||
|
# UTF-8 The 2nd byte differs.
|
||
|
# UTF-8 The 2nd byte differs.
|
||
|
with_settings :repositories_encodings => '' do
|
||
|
diff = Redmine::UnifiedDiff.new(
|
||
|
read_diff_fixture('issue-13644-5.diff'), :type => 'sbs')
|
||
| test/unit/lib/redmine/wiki_formatting/macros_test.rb | ||
|---|---|---|
|
def test_multiple_macros_on_the_same_line
|
||
|
Redmine::WikiFormatting::Macros.macro :foo do |obj, args|
|
||
|
args.any? ? "args: #{args.join(',')}" : "no args"
|
||
|
args.any? ? "args: #{args.join(',')}" : "no args"
|
||
|
end
|
||
|
assert_equal '<p>no args no args</p>', textilizable("{{foo}} {{foo}}")
|
||
| ... | ... | |
|
text = "{{collapse\n*Collapsed* block of text\n}}"
|
||
|
with_locale 'en' do
|
||
|
result = textilizable(text)
|
||
|
|
||
|
assert_select_in result, 'div.collapsed-text'
|
||
|
assert_select_in result, 'strong', :text => 'Collapsed'
|
||
|
assert_select_in result, 'a.collapsible.collapsed', :text => 'Show'
|
||
| ... | ... | |
|
h1. Title
|
||
|
{{collapse(Show example, Hide example)
|
||
|
h2. Heading
|
||
|
h2. Heading
|
||
|
}}"
|
||
|
RAW
|
||
| test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | ||
|---|---|---|
|
This is a table with trailing whitespace in one row:
|
||
|
|cell11|cell12|
|
||
|
|cell21|cell22|
|
||
|
|cell21|cell22|
|
||
|
|cell31|cell32|
|
||
|
RAW
|
||
| ... | ... | |
|
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+}, '')
|
||
|
end
|
||
|
|
||
|
|
||
|
STR_WITHOUT_PRE = [
|
||
|
# 0
|
||
|
"h1. Title
|
||
| ... | ... | |
|
Ut rhoncus elementum adipiscing."]
|
||
|
TEXT_WITHOUT_PRE = STR_WITHOUT_PRE.join("\n\n").freeze
|
||
|
|
||
|
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[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[4], TEXT_WITHOUT_PRE, 6
|
||
|
|
||
|
assert_section_with_hash '', TEXT_WITHOUT_PRE, 0
|
||
|
assert_section_with_hash '', TEXT_WITHOUT_PRE, 10
|
||
|
end
|
||
|
|
||
|
def test_update_section_should_update_the_requested_section
|
||
|
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..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..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(10, replacement)
|
||
|
end
|
||
|
|
||
|
def test_update_section_with_hash_should_update_the_requested_section
|
||
|
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, Digest::MD5.hexdigest(STR_WITHOUT_PRE[1]))
|
||
|
end
|
||
|
|
||
|
def test_update_section_with_wrong_hash_should_raise_an_error
|
||
|
assert_raise Redmine::WikiFormatting::StaleSectionError do
|
||
|
@formatter.new(TEXT_WITHOUT_PRE).update_section(2, "New text", Digest::MD5.hexdigest("Old text"))
|
||
| ... | ... | |
|
def test_update_section_should_not_escape_pre_content_outside_section
|
||
|
text = STR_WITH_PRE.join("\n\n")
|
||
|
replacement = "New text"
|
||
|
|
||
|
assert_equal [STR_WITH_PRE[0..1], "New text"].flatten.join("\n\n"),
|
||
|
@formatter.new(text).update_section(3, replacement)
|
||
|
end
|
||
| ... | ... | |
|
h1. Heading 2
|
||
|
Content 2
|
||
|
|
||
|
h1. Heading 3
|
||
|
Content 3
|
||
|
h1. Heading 4
|
||
|
|
||
|
Content 4
|
||
|
STR
|
||
| ... | ... | |
|
def to_html(text)
|
||
|
@formatter.new(text).to_html
|
||
|
end
|
||
|
|
||
|
def assert_section_with_hash(expected, text, index)
|
||
|
result = @formatter.new(text).get_section(index)
|
||
|
|
||
|
assert_kind_of Array, result
|
||
|
assert_equal 2, result.size
|
||
|
assert_equal expected, result.first, "section content did not match"
|
||
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »