mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 22:05:56 +01:00
fix source indent of JournalsControllerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@20402 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -30,18 +30,19 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_index
|
||||
get :index, :params => {
|
||||
:project_id => 1
|
||||
}
|
||||
get(:index, :params => {:project_id => 1})
|
||||
assert_response :success
|
||||
assert_equal 'application/atom+xml', @response.media_type
|
||||
end
|
||||
|
||||
def test_index_with_invalid_query_id
|
||||
get :index, :params => {
|
||||
get(
|
||||
:index,
|
||||
:params => {
|
||||
:project_id => 1,
|
||||
:query_id => 999
|
||||
}
|
||||
)
|
||||
assert_response 404
|
||||
end
|
||||
|
||||
@@ -49,16 +50,12 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
get :index, :params => {
|
||||
:project_id => 1
|
||||
}
|
||||
get(:index, :params => {:project_id => 1})
|
||||
assert_response :success
|
||||
assert_select 'entry>id', :text => "http://test.host/issues/2?journal_id=#{journal.id}"
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
get :index, :params => {
|
||||
:project_id => 1
|
||||
}
|
||||
get(:index, :params => {:project_id => 1})
|
||||
assert_response :success
|
||||
assert_select 'entry>id', :text => "http://test.host/issues/2?journal_id=#{journal.id}", :count => 0
|
||||
end
|
||||
@@ -93,10 +90,13 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
|
||||
users_to_test.each do |user, visible_fields|
|
||||
get :index, :params => {
|
||||
get(
|
||||
:index,
|
||||
:params => {
|
||||
:format => 'atom',
|
||||
:key => user.rss_key
|
||||
}
|
||||
)
|
||||
@fields.each_with_index do |field, i|
|
||||
if visible_fields.include?(field)
|
||||
assert_select(
|
||||
@@ -117,10 +117,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_diff_for_description_change
|
||||
get :diff, :params => {
|
||||
:id => 3,
|
||||
:detail_id => 4
|
||||
}
|
||||
get(:diff, :params => {:id => 3, :detail_id => 4})
|
||||
assert_response :success
|
||||
|
||||
assert_select 'span.diff_out', :text => /removed/
|
||||
@@ -133,10 +130,13 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
detail = JournalDetail.create!(:journal => journal, :property => 'cf', :prop_key => field.id,
|
||||
:old_value => 'Foo', :value => 'Bar')
|
||||
|
||||
get :diff, :params => {
|
||||
get(
|
||||
:diff,
|
||||
:params => {
|
||||
:id => journal.id,
|
||||
:detail_id => detail.id
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
assert_select 'span.diff_out', :text => /Foo/
|
||||
@@ -149,17 +149,18 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
detail = JournalDetail.create!(:journal => journal, :property => 'cf', :prop_key => field.id,
|
||||
:old_value => 'Foo', :value => 'Bar')
|
||||
|
||||
get :diff, :params => {
|
||||
get(
|
||||
:diff,
|
||||
:params => {
|
||||
:id => journal.id,
|
||||
:detail_id => detail.id
|
||||
}
|
||||
)
|
||||
assert_response 302
|
||||
end
|
||||
|
||||
def test_diff_should_default_to_description_diff
|
||||
get :diff, :params => {
|
||||
:id => 3
|
||||
}
|
||||
get(:diff, :params => {:id => 3})
|
||||
assert_response :success
|
||||
|
||||
assert_select 'span.diff_out', :text => /removed/
|
||||
@@ -168,10 +169,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
def test_reply_to_issue
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :params => {
|
||||
:id => 6
|
||||
},
|
||||
:xhr => true
|
||||
get(:new, :params => {:id => 6}, :xhr => true)
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
@@ -180,21 +178,21 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
def test_reply_to_issue_without_permission
|
||||
@request.session[:user_id] = 7
|
||||
get :new, :params => {
|
||||
:id => 6
|
||||
},
|
||||
:xhr => true
|
||||
get(:new, :params => {:id => 6}, :xhr => true)
|
||||
assert_response 403
|
||||
end
|
||||
|
||||
def test_reply_to_note
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :params => {
|
||||
get(
|
||||
:new,
|
||||
:params => {
|
||||
:id => 6,
|
||||
:journal_id => 4,
|
||||
:journal_indice => 1
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'Redmine Admin wrote in #note-1:', response.body
|
||||
@@ -205,30 +203,33 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true)
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
get :new, :params => {
|
||||
get(
|
||||
:new,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal_id => journal.id
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include '> Privates notes', response.body
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
get :new, :params => {
|
||||
get(
|
||||
:new,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal_id => journal.id
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response 404
|
||||
end
|
||||
|
||||
def test_edit_xhr
|
||||
@request.session[:user_id] = 1
|
||||
get :edit, :params => {
|
||||
:id => 2
|
||||
},
|
||||
:xhr => true
|
||||
get(:edit, :params => {:id => 2}, :xhr => true)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'textarea', response.body
|
||||
@@ -239,31 +240,28 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
Role.find(1).add_permission! :edit_issue_notes
|
||||
|
||||
get :edit, :params => {
|
||||
:id => journal.id
|
||||
},
|
||||
:xhr => true
|
||||
get(:edit, :params => {:id => journal.id}, :xhr => true)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'textarea', response.body
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
get :edit, :params => {
|
||||
:id => journal.id
|
||||
},
|
||||
:xhr => true
|
||||
get(:edit, :params => {:id => journal.id}, :xhr => true)
|
||||
assert_response 404
|
||||
end
|
||||
|
||||
def test_update_xhr
|
||||
@request.session[:user_id] = 1
|
||||
post :update, :params => {
|
||||
post(
|
||||
:update,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal => {
|
||||
:notes => 'Updated notes'
|
||||
}
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_equal 'Updated notes', Journal.find(2).notes
|
||||
@@ -274,13 +272,16 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
|
||||
def test_update_xhr_with_private_notes_checked
|
||||
@request.session[:user_id] = 1
|
||||
post :update, :params => {
|
||||
post(
|
||||
:update,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal => {
|
||||
:private_notes => '1'
|
||||
}
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_equal true, Journal.find(2).private_notes
|
||||
@@ -291,13 +292,16 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
def test_update_xhr_with_private_notes_unchecked
|
||||
Journal.find(2).update(:private_notes => true)
|
||||
@request.session[:user_id] = 1
|
||||
post :update, :params => {
|
||||
post(
|
||||
:update,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal => {
|
||||
:private_notes => '0'
|
||||
}
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_equal false, Journal.find(2).private_notes
|
||||
@@ -311,13 +315,16 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
Role.find(1).add_permission! :view_private_notes
|
||||
Role.find(1).remove_permission! :set_notes_private
|
||||
|
||||
post :update, :params => {
|
||||
post(
|
||||
:update,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal => {
|
||||
:private_notes => '1'
|
||||
}
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal false, Journal.find(2).private_notes
|
||||
end
|
||||
@@ -325,13 +332,16 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
def test_update_xhr_with_empty_notes_should_delete_the_journal
|
||||
@request.session[:user_id] = 1
|
||||
assert_difference 'Journal.count', -1 do
|
||||
post :update, :params => {
|
||||
post(
|
||||
:update,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:journal => {
|
||||
:notes => ''
|
||||
}
|
||||
},
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user