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