Patch #33367 ยป use-exists-instead-of-first.patch
| test/functional/workflows_controller_test.rb | ||
|---|---|---|
|
assert_response 302
|
||
|
assert_equal 3, WorkflowTransition.where(:tracker_id => 1, :role_id => 2).count
|
||
|
assert_not_nil WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2).first
|
||
|
assert_nil WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4).first
|
||
|
assert WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2).exists?
|
||
|
assert_not WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4).exists?
|
||
|
end
|
||
|
def test_post_edit_with_allowed_statuses_for_new_issues
|
||
| test/unit/default_data_test.rb | ||
|---|---|---|
|
def test_load
|
||
|
clear_data
|
||
|
assert Redmine::DefaultData::Loader::load('en')
|
||
|
assert_not_nil DocumentCategory.first
|
||
|
assert_not_nil IssuePriority.first
|
||
|
assert_not_nil TimeEntryActivity.first
|
||
|
assert_not_nil WorkflowTransition.first
|
||
|
assert_not_nil Query.first
|
||
|
assert DocumentCategory.exists?
|
||
|
assert IssuePriority.exists?
|
||
|
assert TimeEntryActivity.exists?
|
||
|
assert WorkflowTransition.exists?
|
||
|
assert Query.exists?
|
||
|
end
|
||
|
def test_load_for_all_language
|
||
| ... | ... | |
|
clear_data
|
||
|
begin
|
||
|
assert Redmine::DefaultData::Loader::load(lang, :workflow => false)
|
||
|
assert_not_nil DocumentCategory.first
|
||
|
assert_not_nil IssuePriority.first
|
||
|
assert_not_nil TimeEntryActivity.first
|
||
|
assert_not_nil Query.first
|
||
|
assert DocumentCategory.exists?
|
||
|
assert IssuePriority.exists?
|
||
|
assert TimeEntryActivity.exists?
|
||
|
assert Query.exists?
|
||
|
rescue ActiveRecord::RecordInvalid => e
|
||
|
assert false, ":#{lang} default data is invalid (#{e.message})."
|
||
|
end
|
||
| test/unit/document_category_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_default
|
||
|
assert_nil DocumentCategory.where(:is_default => true).first
|
||
|
assert_not DocumentCategory.where(:is_default => true).exists?
|
||
|
e = Enumeration.find_by_name('Technical documentation')
|
||
|
e.update(:is_default => true)
|
||
|
assert_equal 3, DocumentCategory.default.id
|
||
|
end
|
||
|
def test_force_default
|
||
|
assert_nil DocumentCategory.where(:is_default => true).first
|
||
|
assert_not DocumentCategory.where(:is_default => true).exists?
|
||
|
assert_equal 1, DocumentCategory.default.id
|
||
|
end
|
||
|
end
|
||
| test/unit/enumeration_test.rb | ||
|---|---|---|
|
def test_destroy_with_reassign
|
||
|
Enumeration.find(4).destroy(Enumeration.find(6))
|
||
|
assert_nil Issue.where(:priority_id => 4).first
|
||
|
assert_not Issue.where(:priority_id => 4).exists?
|
||
|
assert_equal 6, Enumeration.find(6).objects_count
|
||
|
end
|
||
| test/unit/issue_status_test.rb | ||
|---|---|---|
|
assert_difference 'IssueStatus.count', -1 do
|
||
|
assert status.destroy
|
||
|
end
|
||
|
assert_nil WorkflowTransition.where(:old_status_id => status.id).first
|
||
|
assert_nil WorkflowTransition.where(:new_status_id => status.id).first
|
||
|
assert_not WorkflowTransition.where(:old_status_id => status.id).exists?
|
||
|
assert_not WorkflowTransition.where(:new_status_id => status.id).exists?
|
||
|
end
|
||
|
def test_destroy_status_in_use
|
||
| test/unit/issue_test.rb | ||
|---|---|---|
|
def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default
|
||
|
Role.anonymous.update!(:issues_visibility => 'default')
|
||
|
issue = Issue.generate!(:author => User.anonymous, :is_private => true)
|
||
|
assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
|
||
|
assert_not Issue.where(:id => issue.id).visible(User.anonymous).exists?
|
||
|
assert !issue.visible?(User.anonymous)
|
||
|
end
|
||
|
def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own
|
||
|
assert Role.anonymous.update!(:issues_visibility => 'own')
|
||
|
issue = Issue.generate!(:author => User.anonymous, :is_private => true)
|
||
|
assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
|
||
|
assert_not Issue.where(:id => issue.id).visible(User.anonymous).exists?
|
||
|
assert !issue.visible?(User.anonymous)
|
||
|
end
|
||
| test/unit/project_test.rb | ||
|---|---|---|
|
# make sure that the project non longer exists
|
||
|
assert_raise(ActiveRecord::RecordNotFound) {Project.find(@ecookbook.id)}
|
||
|
# make sure related data was removed
|
||
|
assert_nil Member.where(:project_id => @ecookbook.id).first
|
||
|
assert_nil Board.where(:project_id => @ecookbook.id).first
|
||
|
assert_nil Issue.where(:project_id => @ecookbook.id).first
|
||
|
assert_not Member.where(:project_id => @ecookbook.id).exists?
|
||
|
assert_not Board.where(:project_id => @ecookbook.id).exists?
|
||
|
assert_not Issue.where(:project_id => @ecookbook.id).exists?
|
||
|
end
|
||
|
def test_destroy_should_destroy_subtasks
|
||
| test/unit/wiki_redirect_test.rb | ||
|---|---|---|
|
assert WikiRedirect.create(:wiki => @wiki, :title => 'An_old_page', :redirects_to => 'Original_title')
|
||
|
@original.destroy
|
||
|
assert_nil @wiki.redirects.first
|
||
|
assert_not @wiki.redirects.exists?
|
||
|
end
|
||
|
end
|
||