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
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
}
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(
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/
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/
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/
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
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
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
@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
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
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
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
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