mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 11:37:14 +00:00
cleanup: rubocop: fix Layout/IndentFirstHashElement in test/functional/files_controller_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19195 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
badf95d60c
commit
c87fb4d907
@ -39,9 +39,12 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_index
|
||||
get :index, :params => {
|
||||
get(
|
||||
:index,
|
||||
:params => {
|
||||
:project_id => 1
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
# file attached to the project
|
||||
@ -53,22 +56,26 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
|
||||
def test_new
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :params => {
|
||||
get(
|
||||
:new,
|
||||
:params => {
|
||||
:project_id => 1
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
assert_select 'select[name=?]', 'version_id'
|
||||
end
|
||||
|
||||
def test_new_without_versions
|
||||
Version.delete_all
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :params => {
|
||||
get(
|
||||
:new,
|
||||
:params => {
|
||||
:project_id => 1
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
assert_select 'select[name=?]', 'version_id', 0
|
||||
end
|
||||
|
||||
@ -76,17 +83,20 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
with_settings :notified_events => %w(file_added) do
|
||||
assert_difference 'Attachment.count' do
|
||||
post :create, :params => {
|
||||
post(
|
||||
:create,
|
||||
:params => {
|
||||
:project_id => 1,
|
||||
:version_id => '',
|
||||
:attachments => {
|
||||
'1' => {
|
||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
assert_response :redirect
|
||||
end
|
||||
end
|
||||
@ -104,16 +114,19 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
def test_create_version_file
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_difference 'Attachment.count' do
|
||||
post :create, :params => {
|
||||
post(
|
||||
:create,
|
||||
:params => {
|
||||
:project_id => 1,
|
||||
:version_id => '2',
|
||||
:attachments => {
|
||||
'1' => {
|
||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')}
|
||||
'file' => uploaded_test_file('testfile.txt', 'text/plain')
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
assert_response :redirect
|
||||
end
|
||||
assert_redirected_to '/projects/ecookbook/files'
|
||||
@ -125,12 +138,14 @@ class FilesControllerTest < Redmine::ControllerTest
|
||||
def test_create_without_file
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_no_difference 'Attachment.count' do
|
||||
post :create, :params => {
|
||||
post(
|
||||
:create,
|
||||
:params => {
|
||||
:project_id => 1,
|
||||
:version_id => ''
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
end
|
||||
assert_select 'div.error', 'File is invalid'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user