diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 210d96f7ae..93058d5447 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -237,7 +237,7 @@ describe UsersController, type: :controller do it 'should send an email to the correct user in the correct language' do mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal [registered_user.mail], mail.to mail.parts.each do |part| assert part.body.encoded.include?(I18n.t(:notice_account_activated, diff --git a/spec/legacy/functional/activities_controller_spec.rb b/spec/legacy/functional/activities_controller_spec.rb index 490cda52ce..888f21a941 100644 --- a/spec/legacy/functional/activities_controller_spec.rb +++ b/spec/legacy/functional/activities_controller_spec.rb @@ -65,7 +65,7 @@ describe ActivitiesController, type: :controller do get :index, id: 1, with_subprojects: 0 assert_response :success assert_template 'index' - assert_not_nil assigns(:events_by_day) + refute_nil assigns(:events_by_day) assert_tag tag: 'h3', content: /#{1.day.ago.to_date.day}/, @@ -93,7 +93,7 @@ describe ActivitiesController, type: :controller do get :index, id: 1, from: 3.days.ago.to_date assert_response :success assert_template 'index' - assert_not_nil assigns(:events_by_day) + refute_nil assigns(:events_by_day) assert_tag tag: 'h3', content: /#{3.day.ago.to_date.day}/, @@ -122,7 +122,7 @@ describe ActivitiesController, type: :controller do get :index, user_id: 2 assert_response :success assert_template 'index' - assert_not_nil assigns(:events_by_day) + refute_nil assigns(:events_by_day) assert_tag tag: 'h3', content: /#{3.day.ago.to_date.day}/, diff --git a/spec/legacy/functional/admin_controller_spec.rb b/spec/legacy/functional/admin_controller_spec.rb index 79ee6b63ea..9c2e631644 100644 --- a/spec/legacy/functional/admin_controller_spec.rb +++ b/spec/legacy/functional/admin_controller_spec.rb @@ -49,7 +49,7 @@ describe AdminController, type: :controller do get :projects assert_response :success assert_template 'projects' - assert_not_nil assigns(:projects) + refute_nil assigns(:projects) # active projects only assert_nil assigns(:projects).detect { |u| !u.active? } end @@ -59,7 +59,7 @@ describe AdminController, type: :controller do assert_response :success assert_template 'projects' projects = assigns(:projects) - assert_not_nil projects + refute_nil projects assert_equal 1, projects.size assert_equal 'OnlineStore', projects.first.name end diff --git a/spec/legacy/functional/boards_controller_spec.rb b/spec/legacy/functional/boards_controller_spec.rb index 4d11a80d3e..0958d25d8b 100644 --- a/spec/legacy/functional/boards_controller_spec.rb +++ b/spec/legacy/functional/boards_controller_spec.rb @@ -40,8 +40,8 @@ describe BoardsController, type: :controller do get :index, project_id: 1 assert_response :success assert_template 'index' - assert_not_nil assigns(:boards) - assert_not_nil assigns(:project) + refute_nil assigns(:boards) + refute_nil assigns(:project) end it 'should index not found' do @@ -55,7 +55,7 @@ describe BoardsController, type: :controller do get :index, project_id: 1 assert_response :success assert_template 'show' - assert_not_nil assigns(:topics) + refute_nil assigns(:topics) end it 'should create' do @@ -70,18 +70,18 @@ describe BoardsController, type: :controller do get :show, project_id: 1, id: 1 assert_response :success assert_template 'show' - assert_not_nil assigns(:board) - assert_not_nil assigns(:project) - assert_not_nil assigns(:topics) + refute_nil assigns(:board) + refute_nil assigns(:project) + refute_nil assigns(:topics) end it 'should show atom' do get :show, project_id: 1, id: 1, format: 'atom' assert_response :success assert_template 'common/feed' - assert_not_nil assigns(:board) - assert_not_nil assigns(:project) - assert_not_nil assigns(:messages) + refute_nil assigns(:board) + refute_nil assigns(:project) + refute_nil assigns(:messages) end it 'should update' do diff --git a/spec/legacy/functional/custom_fields_controller_spec.rb b/spec/legacy/functional/custom_fields_controller_spec.rb index 6e72cf3d83..13677a2e58 100644 --- a/spec/legacy/functional/custom_fields_controller_spec.rb +++ b/spec/legacy/functional/custom_fields_controller_spec.rb @@ -82,7 +82,7 @@ describe CustomFieldsController, type: :controller do end assert_redirected_to '/custom_fields?tab=WorkPackageCustomField' field = WorkPackageCustomField.find_by(name: 'test_post_new_list') - assert_not_nil field + refute_nil field assert_equal ['0.1', '0.2'], field.possible_values assert_equal 1, field.types.size end diff --git a/spec/legacy/functional/enumerations_controller_spec.rb b/spec/legacy/functional/enumerations_controller_spec.rb index a99e62c244..f81862ed2b 100644 --- a/spec/legacy/functional/enumerations_controller_spec.rb +++ b/spec/legacy/functional/enumerations_controller_spec.rb @@ -52,7 +52,7 @@ describe EnumerationsController, type: :controller do post :destroy, id: 4 assert_response :success assert_template 'destroy' - assert_not_nil Enumeration.find_by(id: 4) + refute_nil Enumeration.find_by(id: 4) end it 'should destroy enumeration in use with reassignment' do diff --git a/spec/legacy/functional/groups_controller_spec.rb b/spec/legacy/functional/groups_controller_spec.rb index fdd0fe76d2..d406c0dd50 100644 --- a/spec/legacy/functional/groups_controller_spec.rb +++ b/spec/legacy/functional/groups_controller_spec.rb @@ -114,7 +114,7 @@ describe GroupsController, type: :controller do get :autocomplete_for_user, id: 10, q: 'mis' assert_response :success users = assigns(:users) - assert_not_nil users + refute_nil users assert users.any? assert !users.include?(Group.find(10).users.first) end diff --git a/spec/legacy/functional/journals_controller_spec.rb b/spec/legacy/functional/journals_controller_spec.rb index d75d481de8..2b1e974fd1 100644 --- a/spec/legacy/functional/journals_controller_spec.rb +++ b/spec/legacy/functional/journals_controller_spec.rb @@ -87,7 +87,7 @@ describe JournalsController, type: :controller do it 'should index' do get :index, project_id: 1, format: :atom assert_response :success - assert_not_nil assigns(:journals) + refute_nil assigns(:journals) assert_equal 'application/atom+xml', response.content_type end end diff --git a/spec/legacy/functional/messages_controller_spec.rb b/spec/legacy/functional/messages_controller_spec.rb index d2a19e2ca7..267daf60a7 100644 --- a/spec/legacy/functional/messages_controller_spec.rb +++ b/spec/legacy/functional/messages_controller_spec.rb @@ -42,9 +42,9 @@ describe MessagesController, type: :controller do get :show, board_id: 1, id: 1 assert_response :success assert_template 'show' - assert_not_nil assigns(:board) - assert_not_nil assigns(:project) - assert_not_nil assigns(:topic) + refute_nil assigns(:board) + refute_nil assigns(:project) + refute_nil assigns(:topic) end it 'should show with pagination' do @@ -60,7 +60,7 @@ describe MessagesController, type: :controller do assert_response :success assert_template 'show' replies = assigns(:replies) - assert_not_nil replies + refute_nil replies assert !replies.include?(message.children.order('id').first) assert replies.include?(message.children.order('id').last) end @@ -95,7 +95,7 @@ describe MessagesController, type: :controller do message: { subject: 'Test created message', content: 'Message body' } message = Message.find_by(subject: 'Test created message') - assert_not_nil message + refute_nil message assert_redirected_to topic_path(message) assert_equal 'Message body', message.content assert_equal 2, message.author_id diff --git a/spec/legacy/functional/my_controller_spec.rb b/spec/legacy/functional/my_controller_spec.rb index e1624e4a6f..42109d6770 100644 --- a/spec/legacy/functional/my_controller_spec.rb +++ b/spec/legacy/functional/my_controller_spec.rb @@ -112,7 +112,7 @@ describe MyController, type: :controller do end it 'should destroy the existing token' do - assert_not_equal @previous_token_value, User.find(2).rss_key + refute_equal @previous_token_value, User.find(2).rss_key end it 'should create a new token' do @@ -146,7 +146,7 @@ describe MyController, type: :controller do end it 'should destroy the existing token' do - assert_not_equal @previous_token_value, User.find(2).api_key + refute_equal @previous_token_value, User.find(2).api_key end it 'should create a new token' do diff --git a/spec/legacy/functional/project_enumerations_controller_spec.rb b/spec/legacy/functional/project_enumerations_controller_spec.rb index 22fbdc3859..101e43dbf6 100644 --- a/spec/legacy/functional/project_enumerations_controller_spec.rb +++ b/spec/legacy/functional/project_enumerations_controller_spec.rb @@ -59,7 +59,7 @@ describe ProjectEnumerationsController, type: :controller do assert design, 'Project activity not found' assert_equal 9, design.parent_id # Relate to the system activity - assert_not_equal design.parent.id, design.id # Different records + refute_equal design.parent.id, design.id # Different records assert_equal design.parent.name, design.name # Same name assert !design.active? @@ -68,7 +68,7 @@ describe ProjectEnumerationsController, type: :controller do assert development, 'Project activity not found' assert_equal 10, development.parent_id # Relate to the system activity - assert_not_equal development.parent.id, development.id # Different records + refute_equal development.parent.id, development.id # Different records assert_equal development.parent.name, development.name # Same name assert development.active? assert_equal '0', development.custom_value_for(billable_field).value @@ -78,7 +78,7 @@ describe ProjectEnumerationsController, type: :controller do assert previously_inactive, 'Project activity not found' assert_equal 14, previously_inactive.parent_id # Relate to the system activity - assert_not_equal previously_inactive.parent.id, previously_inactive.id # Different records + refute_equal previously_inactive.parent.id, previously_inactive.id # Different records assert_equal previously_inactive.parent.name, previously_inactive.name # Same name assert previously_inactive.active? assert_equal '1', previously_inactive.custom_value_for(billable_field).value diff --git a/spec/legacy/functional/projects_controller_spec.rb b/spec/legacy/functional/projects_controller_spec.rb index 102abebbe4..694c3171aa 100644 --- a/spec/legacy/functional/projects_controller_spec.rb +++ b/spec/legacy/functional/projects_controller_spec.rb @@ -45,7 +45,7 @@ describe ProjectsController, type: :controller do get :index assert_response :success assert_template 'index' - assert_not_nil assigns(:projects) + refute_nil assigns(:projects) assert_tag :ul, child: { tag: 'li', descendant: { tag: 'a', content: 'eCookbook' }, @@ -302,14 +302,14 @@ describe ProjectsController, type: :controller do get :show, id: 1 assert_response :success assert_template 'show' - assert_not_nil assigns(:project) + refute_nil assigns(:project) end it 'should show by identifier' do get :show, id: 'ecookbook' assert_response :success assert_template 'show' - assert_not_nil assigns(:project) + refute_nil assigns(:project) assert_equal Project.find_by(identifier: 'ecookbook'), assigns(:project) assert_tag 'li', content: /Development status/ @@ -320,7 +320,7 @@ describe ProjectsController, type: :controller do get :show, id: 'ecookbook' assert_response :success assert_template 'show' - assert_not_nil assigns(:project) + refute_nil assigns(:project) assert_no_tag 'li', content: /Development status/ end @@ -331,7 +331,7 @@ describe ProjectsController, type: :controller do get :show, id: 'ecookbook' assert_response :success assert_template 'show' - assert_not_nil assigns(:project) + refute_nil assigns(:project) assert_equal Project.find_by(identifier: 'ecookbook'), assigns(:project) end @@ -390,7 +390,7 @@ describe ProjectsController, type: :controller do get :destroy_info, id: 1 assert_response :success assert_template 'destroy_info' - assert_not_nil Project.find_by(id: 1) + refute_nil Project.find_by(id: 1) end it 'should post destroy' do diff --git a/spec/legacy/functional/repositories_controller_spec.rb b/spec/legacy/functional/repositories_controller_spec.rb index cfda31a316..1d9b11d58f 100644 --- a/spec/legacy/functional/repositories_controller_spec.rb +++ b/spec/legacy/functional/repositories_controller_spec.rb @@ -60,13 +60,13 @@ describe RepositoriesController, type: :controller do get :revisions, project_id: 1 assert_response :success assert_template 'revisions' - assert_not_nil assigns(:changesets) + refute_nil assigns(:changesets) end it 'should revision' do get :revision, project_id: 1, rev: 1 assert_response :success - assert_not_nil assigns(:changeset) + refute_nil assigns(:changeset) assert_equal '1', assigns(:changeset).revision end diff --git a/spec/legacy/functional/repositories_git_controller_spec.rb b/spec/legacy/functional/repositories_git_controller_spec.rb index 689862f7e7..d64276c8e3 100644 --- a/spec/legacy/functional/repositories_git_controller_spec.rb +++ b/spec/legacy/functional/repositories_git_controller_spec.rb @@ -67,7 +67,7 @@ describe RepositoriesController, 'Git', type: :controller do get :show, project_id: 3 assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal 10, assigns(:entries).size assert assigns(:entries).detect { |e| e.name == 'images' && e.kind == 'dir' } assert assigns(:entries).detect { |e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir' } @@ -78,7 +78,7 @@ describe RepositoriesController, 'Git', type: :controller do assert assigns(:entries).detect { |e| e.name == 'renamed_test.txt' && e.kind == 'file' } assert assigns(:entries).detect { |e| e.name == 'filemane with spaces.txt' && e.kind == 'file' } assert assigns(:entries).detect { |e| e.name == ' filename with a leading space.txt ' && e.kind == 'file' } - assert_not_nil assigns(:changesets) + refute_nil assigns(:changesets) assigns(:changesets).size > 0 end @@ -88,13 +88,13 @@ describe RepositoriesController, 'Git', type: :controller do get :show, project_id: 3, rev: 'test_branch' assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal 4, assigns(:entries).size assert assigns(:entries).detect { |e| e.name == 'images' && e.kind == 'dir' } assert assigns(:entries).detect { |e| e.name == 'sources' && e.kind == 'dir' } assert assigns(:entries).detect { |e| e.name == 'README' && e.kind == 'file' } assert assigns(:entries).detect { |e| e.name == 'test.txt' && e.kind == 'file' } - assert_not_nil assigns(:changesets) + refute_nil assigns(:changesets) assigns(:changesets).size > 0 end @@ -108,9 +108,9 @@ describe RepositoriesController, 'Git', type: :controller do get :show, project_id: 3, rev: t1 assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assigns(:entries).size > 0 - assert_not_nil assigns(:changesets) + refute_nil assigns(:changesets) assigns(:changesets).size > 0 end end @@ -121,13 +121,13 @@ describe RepositoriesController, 'Git', type: :controller do get :show, project_id: 3, path: 'images' assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal ['edit.png'], assigns(:entries).map(&:name) entry = assigns(:entries).detect { |e| e.name == 'edit.png' } - assert_not_nil entry + refute_nil entry assert_equal 'file', entry.kind assert_equal 'images/edit.png', entry.path - assert_not_nil assigns(:changesets) + refute_nil assigns(:changesets) assigns(:changesets).size > 0 end @@ -137,9 +137,9 @@ describe RepositoriesController, 'Git', type: :controller do get :show, project_id: 3, path: 'images', rev: '7234cb2750b63f47bff735edc50a1c0a433c2518' assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal ['delete.png'], assigns(:entries).map(&:name) - assert_not_nil assigns(:changesets) + refute_nil assigns(:changesets) assigns(:changesets).size > 0 end @@ -172,7 +172,7 @@ describe RepositoriesController, 'Git', type: :controller do get :entry, project_id: 3, path: 'sources' assert_response :success assert_template 'show' - assert_not_nil assigns(:entry) + refute_nil assigns(:entry) assert_equal 'sources', assigns(:entry).name end @@ -203,7 +203,7 @@ describe RepositoriesController, 'Git', type: :controller do assert_template 'diff' diff = assigns(:diff) - assert_not_nil diff + refute_nil diff assert_tag tag: 'h2', content: /2f9c0091:61b685fb/ end diff --git a/spec/legacy/functional/repositories_subversion_controller_spec.rb b/spec/legacy/functional/repositories_subversion_controller_spec.rb index 4223654aa2..e6f92721ea 100644 --- a/spec/legacy/functional/repositories_subversion_controller_spec.rb +++ b/spec/legacy/functional/repositories_subversion_controller_spec.rb @@ -64,8 +64,8 @@ describe RepositoriesController, 'Subversion', type: :controller do get :show, project_id: PRJ_ID assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) - assert_not_nil assigns(:changesets) + refute_nil assigns(:entries) + refute_nil assigns(:changesets) end it 'should browse root' do @@ -74,7 +74,7 @@ describe RepositoriesController, 'Subversion', type: :controller do get :show, project_id: PRJ_ID assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) entry = assigns(:entries).detect { |e| e.name == 'subversion_test' } assert_equal 'dir', entry.kind end @@ -85,7 +85,7 @@ describe RepositoriesController, 'Subversion', type: :controller do get :show, project_id: PRJ_ID, path: 'subversion_test' assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal ['[folder_with_brackets]', 'folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).map(&:name) entry = assigns(:entries).detect { |e| e.name == 'helloworld.c' } assert_equal 'file', entry.kind @@ -99,7 +99,7 @@ describe RepositoriesController, 'Subversion', type: :controller do get :show, project_id: PRJ_ID, path: 'subversion_test', rev: 4 assert_response :success assert_template 'show' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).map(&:name) end @@ -111,12 +111,12 @@ describe RepositoriesController, 'Subversion', type: :controller do assert_template 'changes' changesets = assigns(:changesets) - assert_not_nil changesets + refute_nil changesets assert_equal %w(6 3 2), changesets.map(&:revision) # svn properties displayed with svn >= 1.5 only if @repository.scm.client_version_above?([1, 5, 0]) - assert_not_nil assigns(:properties) + refute_nil assigns(:properties) assert_equal 'native', assigns(:properties)['svn:eol-style'] assert_tag :ul, child: { tag: 'li', @@ -133,7 +133,7 @@ describe RepositoriesController, 'Subversion', type: :controller do assert_template 'changes' changesets = assigns(:changesets) - assert_not_nil changesets + refute_nil changesets assert_equal %w(10 9 7 6 5 2), changesets.map(&:revision) end @@ -191,7 +191,7 @@ describe RepositoriesController, 'Subversion', type: :controller do get :entry, project_id: PRJ_ID, path: 'subversion_test/folder' assert_response :success assert_template 'show' - assert_not_nil assigns(:entry) + refute_nil assigns(:entry) assert_equal 'folder', assigns(:entry).name end @@ -281,7 +281,7 @@ describe RepositoriesController, 'Subversion', type: :controller do assert_template 'diff' diff = assigns(:diff) - assert_not_nil diff + refute_nil diff # 2 files modified assert_equal 2, Redmine::UnifiedDiff.new(diff).size diff --git a/spec/legacy/functional/roles_controller_spec.rb b/spec/legacy/functional/roles_controller_spec.rb index 13cc3a9235..4bb5f6082a 100644 --- a/spec/legacy/functional/roles_controller_spec.rb +++ b/spec/legacy/functional/roles_controller_spec.rb @@ -44,7 +44,7 @@ describe RolesController, type: :controller do assert_response :success assert_template 'index' - assert_not_nil assigns(:roles) + refute_nil assigns(:roles) assert_equal Role.order('builtin, position').to_a, assigns(:roles) assert_tag tag: 'a', attributes: { href: edit_role_path(1) }, @@ -74,7 +74,7 @@ describe RolesController, type: :controller do assert_redirected_to roles_path role = Role.find_by(name: 'RoleWithoutWorkflowCopy') - assert_not_nil role + refute_nil role assert_equal [:add_work_packages, :edit_work_packages, :log_time], role.permissions assert !role.assignable? end @@ -87,7 +87,7 @@ describe RolesController, type: :controller do assert_redirected_to roles_path role = Role.find_by(name: 'RoleWithWorkflowCopy') - assert_not_nil role + refute_nil role assert_equal Role.find(1).workflows.size, role.workflows.size end @@ -122,7 +122,7 @@ describe RolesController, type: :controller do delete :destroy, id: 1 assert_redirected_to roles_path assert flash[:error] == 'This role is in use and cannot be deleted.' - assert_not_nil Role.find_by(id: 1) + refute_nil Role.find_by(id: 1) end it 'should get report' do @@ -130,7 +130,7 @@ describe RolesController, type: :controller do assert_response :success assert_template 'report' - assert_not_nil assigns(:roles) + refute_nil assigns(:roles) assert_equal Role.order('builtin, position'), assigns(:roles) assert_tag tag: 'input', attributes: { type: 'checkbox', diff --git a/spec/legacy/functional/search_controller_spec.rb b/spec/legacy/functional/search_controller_spec.rb index 91661c2d2b..350cc2ac28 100644 --- a/spec/legacy/functional/search_controller_spec.rb +++ b/spec/legacy/functional/search_controller_spec.rb @@ -67,7 +67,7 @@ describe SearchController, type: :controller do get :index, project_id: 1 assert_response :success assert_template 'index' - assert_not_nil assigns(:project) + refute_nil assigns(:project) get :index, project_id: 1, q: 'can' assert_response :success @@ -78,7 +78,7 @@ describe SearchController, type: :controller do get :index, project_id: 1, q: 'stringforcustomfield' assert_response :success results = assigns(:results) - assert_not_nil results + refute_nil results assert_equal 1, results.size assert results.include?(WorkPackage.find(7)) end @@ -87,7 +87,7 @@ describe SearchController, type: :controller do # 'all words' is on by default get :index, project_id: 1, q: 'recipe updating saving' results = assigns(:results) - assert_not_nil results + refute_nil results assert_equal 1, results.size assert results.include?(WorkPackage.find(3)) end @@ -95,7 +95,7 @@ describe SearchController, type: :controller do it 'should search one of the words' do get :index, project_id: 1, q: 'recipe updating saving', submit: 'Search' results = assigns(:results) - assert_not_nil results + refute_nil results assert_equal 3, results.size assert results.include?(WorkPackage.find(3)) end @@ -103,14 +103,14 @@ describe SearchController, type: :controller do it 'should search titles only without result' do get :index, project_id: 1, q: 'recipe updating saving', all_words: '1', titles_only: '1', submit: 'Search' results = assigns(:results) - assert_not_nil results + refute_nil results assert_equal 0, results.size end it 'should search titles only' do get :index, project_id: 1, q: 'recipe', titles_only: '1', submit: 'Search' results = assigns(:results) - assert_not_nil results + refute_nil results assert_equal 2, results.size end diff --git a/spec/legacy/functional/time_entries/reports_controller_spec.rb b/spec/legacy/functional/time_entries/reports_controller_spec.rb index 9ca3b9ab63..7d006725a5 100644 --- a/spec/legacy/functional/time_entries/reports_controller_spec.rb +++ b/spec/legacy/functional/time_entries/reports_controller_spec.rb @@ -63,7 +63,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, columns: 'week', from: '2007-04-01', to: '2007-04-30', criterias: ['project'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '8.65', '%.2f' % assigns(:total_hours) end @@ -71,7 +71,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, criterias: ['project', 'issue'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '162.90', '%.2f' % assigns(:total_hours) end @@ -79,7 +79,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, criterias: ['project', 'issue'], columns: 'day' assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '162.90', '%.2f' % assigns(:total_hours) assert_tag tag: 'th', content: '2007-03-12' end @@ -88,7 +88,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, columns: 'week', from: '2007-04-01', to: '2007-04-30', criterias: ['project'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '8.65', '%.2f' % assigns(:total_hours) end @@ -96,7 +96,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, columns: 'month', from: '2007-01-01', to: '2007-12-31', criterias: ['member', 'activity'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '162.90', '%.2f' % assigns(:total_hours) end @@ -104,7 +104,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, columns: 'day', from: '2007-03-23', to: '2007-03-23', criterias: ['member', 'activity'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '4.25', '%.2f' % assigns(:total_hours) end @@ -112,7 +112,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, work_package_id: 1, columns: 'month', from: '2007-01-01', to: '2007-12-31', criterias: ['member', 'activity'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '154.25', '%.2f' % assigns(:total_hours) assert_tag :form, attributes: { action: work_package_time_entries_report_path(1), id: 'query_form' } @@ -122,8 +122,8 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, criterias: ['project', 'cf_1', 'cf_7'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) - assert_not_nil assigns(:criterias) + refute_nil assigns(:total_hours) + refute_nil assigns(:criterias) assert_equal 3, assigns(:criterias).size assert_equal '162.90', '%.2f' % assigns(:total_hours) # Custom field column @@ -141,7 +141,7 @@ describe TimeEntries::ReportsController, type: :controller do get :show, project_id: 1, columns: 'week', from: '1998-04-01', to: '1998-04-30', criterias: ['project'] assert_response :success assert_template 'time_entries/reports/show' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '0.00', '%.2f' % assigns(:total_hours) end diff --git a/spec/legacy/functional/timelog_controller_spec.rb b/spec/legacy/functional/timelog_controller_spec.rb index 93d9ec6f61..438b525ab7 100644 --- a/spec/legacy/functional/timelog_controller_spec.rb +++ b/spec/legacy/functional/timelog_controller_spec.rb @@ -90,7 +90,7 @@ describe TimelogController, type: :controller do i = WorkPackage.find(1) t = TimeEntry.find_by(comments: 'Some work on TimelogControllerTest') - assert_not_nil t + refute_nil t assert_equal 11, t.activity_id assert_equal 7.3, t.hours assert_equal 3, t.user_id @@ -112,7 +112,7 @@ describe TimelogController, type: :controller do assert_redirected_to action: 'index', project_id: 'ecookbook' t = TimeEntry.find_by(comments: 'Some work on TimelogControllerTest') - assert_not_nil t + refute_nil t assert_equal 11, t.activity_id assert_equal 7.3, t.hours assert_equal 3, t.user_id @@ -154,7 +154,7 @@ describe TimelogController, type: :controller do delete :destroy, id: 1 assert_redirected_to action: 'index', project_id: 'ecookbook' assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] - assert_not_nil TimeEntry.find_by(id: 1) + refute_nil TimeEntry.find_by(id: 1) # remove the simulation TimeEntry._destroy_callbacks.reject! { |callback| callback.filter == :stop_callback_chain } @@ -164,7 +164,7 @@ describe TimelogController, type: :controller do get :index assert_response :success assert_template 'index' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '162.90', '%.2f' % assigns(:total_hours) assert_tag :form, attributes: { action: '/time_entries', id: 'query_form' } @@ -174,11 +174,11 @@ describe TimelogController, type: :controller do get :index, project_id: 'ecookbook' assert_response :success assert_template 'index' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal 4, assigns(:entries).size # project and subproject assert_equal [1, 3], assigns(:entries).map(&:project_id).uniq.sort - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '162.90', '%.2f' % assigns(:total_hours) # display all time by default assert_equal '2007-03-12'.to_date, assigns(:from) @@ -191,9 +191,9 @@ describe TimelogController, type: :controller do get :index, project_id: 'ecookbook', from: '2007-03-20', to: '2007-04-30' assert_response :success assert_template 'index' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal 3, assigns(:entries).size - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '12.90', '%.2f' % assigns(:total_hours) assert_equal '2007-03-20'.to_date, assigns(:from) assert_equal '2007-04-30'.to_date, assigns(:to) @@ -205,8 +205,8 @@ describe TimelogController, type: :controller do get :index, project_id: 'ecookbook', period: '7_days' assert_response :success assert_template 'index' - assert_not_nil assigns(:entries) - assert_not_nil assigns(:total_hours) + refute_nil assigns(:entries) + refute_nil assigns(:total_hours) assert_equal Date.today - 7, assigns(:from) assert_equal Date.today, assigns(:to) assert_tag :form, @@ -217,7 +217,7 @@ describe TimelogController, type: :controller do get :index, project_id: 'ecookbook', from: '2007-03-23', to: '2007-03-23' assert_response :success assert_template 'index' - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal '4.25', '%.2f' % assigns(:total_hours) assert_tag :form, attributes: { action: '/projects/ecookbook/time_entries', id: 'query_form' } @@ -227,9 +227,9 @@ describe TimelogController, type: :controller do get :index, work_package_id: 1 assert_response :success assert_template 'index' - assert_not_nil assigns(:entries) + refute_nil assigns(:entries) assert_equal 2, assigns(:entries).size - assert_not_nil assigns(:total_hours) + refute_nil assigns(:total_hours) assert_equal 154.25, assigns(:total_hours) # display all time based on what's been logged assert_equal '2007-03-12'.to_date, assigns(:from) @@ -244,7 +244,7 @@ describe TimelogController, type: :controller do get :index, project_id: 1, format: 'atom' assert_response :success assert_equal 'application/atom+xml', response.content_type - assert_not_nil assigns(:items) + refute_nil assigns(:items) assert assigns(:items).first.is_a?(TimeEntry) end end diff --git a/spec/legacy/functional/types_controller_spec.rb b/spec/legacy/functional/types_controller_spec.rb index 0585a1f2ed..d6716233df 100644 --- a/spec/legacy/functional/types_controller_spec.rb +++ b/spec/legacy/functional/types_controller_spec.rb @@ -122,6 +122,6 @@ describe TypesController, type: :controller do post :destroy, id: 1 end assert_redirected_to action: 'index' - assert_not_nil flash[:error] + refute_nil flash[:error] end end diff --git a/spec/legacy/functional/user_mailer_spec.rb b/spec/legacy/functional/user_mailer_spec.rb index da90c82b15..7e011b81a7 100644 --- a/spec/legacy/functional/user_mailer_spec.rb +++ b/spec/legacy/functional/user_mailer_spec.rb @@ -203,7 +203,7 @@ describe UserMailer, type: :mailer do issue = FactoryGirl.create(:work_package) mail = UserMailer.work_package_added(user, issue.journals.first, user) assert mail.deliver - assert_not_nil mail + refute_nil mail assert_equal 'bulk', mail.header['Precedence'].to_s assert_equal 'auto-generated', mail.header['Auto-Submitted'].to_s end @@ -236,7 +236,7 @@ describe UserMailer, type: :mailer do UserMailer.test_mail(user).deliver end mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal 'Redmine app ', mail.header['From'].to_s end @@ -266,7 +266,7 @@ describe UserMailer, type: :mailer do issue = FactoryGirl.create(:work_package) mail = UserMailer.work_package_added(user, issue.journals.first, user) mail.deliver - assert_not_nil mail + refute_nil mail assert_equal UserMailer.generate_message_id(issue, user), mail.message_id assert_nil mail.references end @@ -277,7 +277,7 @@ describe UserMailer, type: :mailer do journal = issue.journals.first UserMailer.work_package_updated(user, journal).deliver mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal UserMailer.generate_message_id(journal, user), mail.message_id assert_match mail.references, UserMailer.generate_message_id(journal.journable, user) end @@ -287,7 +287,7 @@ describe UserMailer, type: :mailer do message = FactoryGirl.create(:message) UserMailer.message_posted(user, message, user).deliver mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal UserMailer.generate_message_id(message, user), mail.message_id assert_nil mail.references assert_select_email do @@ -302,7 +302,7 @@ describe UserMailer, type: :mailer do message = FactoryGirl.create(:message, parent: parent) UserMailer.message_posted(user, message, user).deliver mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal UserMailer.generate_message_id(message, user), mail.message_id assert_match mail.references, UserMailer.generate_message_id(parent, user) assert_select_email do @@ -465,7 +465,7 @@ describe UserMailer, type: :mailer do def last_email mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail mail end diff --git a/spec/legacy/functional/users_controller_spec.rb b/spec/legacy/functional/users_controller_spec.rb index 5ac0aca13a..178d9a0bce 100644 --- a/spec/legacy/functional/users_controller_spec.rb +++ b/spec/legacy/functional/users_controller_spec.rb @@ -50,7 +50,7 @@ describe UsersController, type: :controller do get :index assert_response :success assert_template 'index' - assert_not_nil assigns(:users) + refute_nil assigns(:users) # active users only assert_nil assigns(:users).detect { |u| !u.active? } end @@ -60,7 +60,7 @@ describe UsersController, type: :controller do assert_response :success assert_template 'index' users = assigns(:users) - assert_not_nil users + refute_nil users assert_equal 1, users.size assert_equal 'John', users.first.firstname end @@ -80,7 +80,7 @@ describe UsersController, type: :controller do get :show, id: 2 assert_response :success assert_template 'show' - assert_not_nil assigns(:user) + refute_nil assigns(:user) assert_no_tag 'li', content: /Phone number/ end @@ -112,7 +112,7 @@ describe UsersController, type: :controller do session[:user_id] = 1 get :show, id: 5 assert_response 200 - assert_not_nil assigns(:user) + refute_nil assigns(:user) end it 'should show displays memberships based on project visibility' do @@ -120,7 +120,7 @@ describe UsersController, type: :controller do get :show, id: 2 assert_response :success memberships = assigns(:memberships) - assert_not_nil memberships + refute_nil memberships project_ids = memberships.map(&:project_id) assert project_ids.include?(2) # private project admin can see end @@ -177,7 +177,7 @@ describe UsersController, type: :controller do assert user.check_password?('adminADMIN!') mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal [user.mail], mail.to assert mail.body.encoded.include?('adminADMIN!') end @@ -227,7 +227,7 @@ describe UsersController, type: :controller do assert u.check_password?('newpassPASS!') mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert_equal [u.mail], mail.to assert mail.body.encoded.include?('newpassPASS!') end diff --git a/spec/legacy/functional/welcome_controller_spec.rb b/spec/legacy/functional/welcome_controller_spec.rb index b1f832673e..7fefd6884d 100644 --- a/spec/legacy/functional/welcome_controller_spec.rb +++ b/spec/legacy/functional/welcome_controller_spec.rb @@ -43,8 +43,8 @@ describe WelcomeController, type: :controller do get :index assert_response :success assert_template 'index' - assert_not_nil assigns(:news) - assert_not_nil assigns(:projects) + refute_nil assigns(:news) + refute_nil assigns(:projects) assert !assigns(:projects).include?(Project.where(is_public: false).first) end diff --git a/spec/legacy/functional/wiki_controller_spec.rb b/spec/legacy/functional/wiki_controller_spec.rb index d70aa567db..90e087c477 100644 --- a/spec/legacy/functional/wiki_controller_spec.rb +++ b/spec/legacy/functional/wiki_controller_spec.rb @@ -102,7 +102,7 @@ describe WikiController, type: :controller do assert_redirected_to action: 'show', project_id: 'ecookbook', id: 'New_page' page = wiki.find_page('New page') assert !page.new_record? - assert_not_nil page.content + refute_nil page.content assert_equal 'Created the page', page.content.last_journal.notes end @@ -233,7 +233,7 @@ describe WikiController, type: :controller do get :history, project_id: 1, id: 'CookBook_documentation' assert_response :success assert_template 'history' - assert_not_nil assigns(:versions) + refute_nil assigns(:versions) assert_equal 3, assigns(:versions).size assert_select 'input[type=submit][name=commit]' end @@ -246,7 +246,7 @@ describe WikiController, type: :controller do get :history, project_id: 1, id: 'Another_page' assert_response :success assert_template 'history' - assert_not_nil assigns(:versions) + refute_nil assigns(:versions) assert_equal 1, assigns(:versions).size assert_select 'input[type=submit][name=commit]', false end @@ -312,7 +312,7 @@ describe WikiController, type: :controller do redirect_existing_links: 1 } assert_redirected_to action: 'show', project_id: 'ecookbook', id: 'Another_renamed_page' # Check redirects - assert_not_nil wiki.find_page('Another page') + refute_nil wiki.find_page('Another page') assert_nil wiki.find_page('Another page', with_redirect: false) end @@ -375,7 +375,7 @@ describe WikiController, type: :controller do assert_response :success assert_template 'index' pages = assigns(:pages) - assert_not_nil pages + refute_nil pages assert_equal wiki.pages.size, pages.size assert_equal pages.first.content.updated_on, pages.first.updated_on diff --git a/spec/legacy/functional/wikis_controller_spec.rb b/spec/legacy/functional/wikis_controller_spec.rb index e3de5df3b0..502c997c17 100644 --- a/spec/legacy/functional/wikis_controller_spec.rb +++ b/spec/legacy/functional/wikis_controller_spec.rb @@ -42,7 +42,7 @@ describe WikisController, type: :controller do post :edit, id: 3, wiki: { start_page: 'Start page' } assert_response :success wiki = Project.find(3).wiki - assert_not_nil wiki + refute_nil wiki assert_equal 'Start page', wiki.start_page end diff --git a/spec/legacy/functional/workflows_controller_spec.rb b/spec/legacy/functional/workflows_controller_spec.rb index 1c662d3241..43484aa8b7 100644 --- a/spec/legacy/functional/workflows_controller_spec.rb +++ b/spec/legacy/functional/workflows_controller_spec.rb @@ -53,8 +53,8 @@ describe WorkflowsController, type: :controller do get :edit assert_response :success assert_template 'edit' - assert_not_nil assigns(:roles) - assert_not_nil assigns(:types) + refute_nil assigns(:roles) + refute_nil assigns(:types) end it 'should get edit with role and type' do @@ -67,7 +67,7 @@ describe WorkflowsController, type: :controller do assert_template 'edit' # used status only - assert_not_nil assigns(:statuses) + refute_nil assigns(:statuses) assert_equal [2, 3, 5], assigns(:statuses).map(&:id) # allowed transitions @@ -92,7 +92,7 @@ describe WorkflowsController, type: :controller do assert_response :success assert_template 'edit' - assert_not_nil assigns(:statuses) + refute_nil assigns(:statuses) assert_equal Status.count, assigns(:statuses).size assert_tag tag: 'input', attributes: { type: 'checkbox', @@ -110,7 +110,7 @@ describe WorkflowsController, type: :controller do assert_redirected_to '/workflows/edit?role_id=2&type_id=1' assert_equal 3, Workflow.where(type_id: 1, role_id: 2).count - assert_not_nil Workflow.where(role_id: 2, type_id: 1, old_status_id: 3, new_status_id: 2).first + refute_nil Workflow.where(role_id: 2, type_id: 1, old_status_id: 3, new_status_id: 2).first assert_nil Workflow.where(role_id: 2, type_id: 1, old_status_id: 5, new_status_id: 4).first end diff --git a/spec/legacy/unit/activity_spec.rb b/spec/legacy/unit/activity_spec.rb index a03ecfe87d..74404663fc 100644 --- a/spec/legacy/unit/activity_spec.rb +++ b/spec/legacy/unit/activity_spec.rb @@ -49,7 +49,7 @@ describe Activity, type: :model do it 'should activity without subprojects' do events = find_events(User.anonymous, project: @project) - assert_not_nil events + refute_nil events assert events.include?(WorkPackage.find(1)) assert !events.include?(WorkPackage.find(4)) @@ -59,7 +59,7 @@ describe Activity, type: :model do it 'should activity with subprojects' do events = find_events(User.anonymous, project: @project, with_subprojects: 1) - assert_not_nil events + refute_nil events assert events.include?(WorkPackage.find(1)) # subproject issue @@ -68,7 +68,7 @@ describe Activity, type: :model do it 'should global activity anonymous' do events = find_events(User.anonymous) - assert_not_nil events + refute_nil events assert events.include?(WorkPackage.find(1)) assert events.include?(Message.find(5)) @@ -78,7 +78,7 @@ describe Activity, type: :model do it 'should global activity logged user' do events = find_events(User.find(2)) # manager - assert_not_nil events + refute_nil events assert events.include?(WorkPackage.find(1)) # Issue of a private project the user belongs to diff --git a/spec/legacy/unit/journal_spec.rb b/spec/legacy/unit/journal_spec.rb index 260696ff8a..bff34ded1d 100644 --- a/spec/legacy/unit/journal_spec.rb +++ b/spec/legacy/unit/journal_spec.rb @@ -95,7 +95,7 @@ describe Journal, type: :model do @issue.save end - assert_not_equal start, @issue.reload.updated_at + refute_equal start, @issue.reload.updated_at end specify 'accessing #journaled on a Journal should not error (parent class)' do diff --git a/spec/legacy/unit/lib/redmine/i18n_spec.rb b/spec/legacy/unit/lib/redmine/i18n_spec.rb index caf7333961..1dc2091534 100644 --- a/spec/legacy/unit/lib/redmine/i18n_spec.rb +++ b/spec/legacy/unit/lib/redmine/i18n_spec.rb @@ -58,8 +58,8 @@ describe Redmine::I18n do format_date(Date.today) format_time(Time.now) format_time(Time.now, false) - assert_not_equal 'default', ::I18n.l(Date.today, format: :default), "date.formats.default missing in #{lang}" - assert_not_equal 'time', ::I18n.l(Time.now, format: :time), "time.formats.time missing in #{lang}" + refute_equal 'default', ::I18n.l(Date.today, format: :default), "date.formats.default missing in #{lang}" + refute_equal 'time', ::I18n.l(Time.now, format: :time), "time.formats.time missing in #{lang}" end assert l('date.day_names').is_a?(Array) assert_equal 7, l('date.day_names').size diff --git a/spec/legacy/unit/lib/redmine/menu_manager/mapper_spec.rb b/spec/legacy/unit/lib/redmine/menu_manager/mapper_spec.rb index c664fb3d7b..7bb9a8c1d1 100644 --- a/spec/legacy/unit/lib/redmine/menu_manager/mapper_spec.rb +++ b/spec/legacy/unit/lib/redmine/menu_manager/mapper_spec.rb @@ -72,7 +72,7 @@ describe Redmine::MenuManager::Mapper do root = menu_mapper.find(:root) assert_equal 5, root.children.size { 0 => :test_first, 1 => :test_second, 2 => :test_third, 3 => :test_fourth, 4 => :test_fifth }.each do |position, name| - assert_not_nil root.children[position] + refute_nil root.children[position] assert_equal name, root.children[position].name end end @@ -88,7 +88,7 @@ describe Redmine::MenuManager::Mapper do root = menu_mapper.find(:root) assert_equal 5, root.children.size { 0 => :test_first, 1 => :test_second, 2 => :test_third, 3 => :test_fourth, 4 => :test_fifth }.each do |position, name| - assert_not_nil root.children[position] + refute_nil root.children[position] assert_equal name, root.children[position].name end end @@ -104,7 +104,7 @@ describe Redmine::MenuManager::Mapper do root = menu_mapper.find(:root) assert_equal 5, root.children.size { 0 => :test_first, 1 => :test_second, 2 => :test_third, 3 => :test_fourth, 4 => :test_fifth }.each do |position, name| - assert_not_nil root.children[position] + refute_nil root.children[position] assert_equal name, root.children[position].name end end @@ -120,7 +120,7 @@ describe Redmine::MenuManager::Mapper do root = menu_mapper.find(:root) assert_equal 5, root.children.size { 0 => :test_first, 1 => :test_second, 2 => :test_third, 3 => :test_fourth, 4 => :test_fifth }.each do |position, name| - assert_not_nil root.children[position] + refute_nil root.children[position] assert_equal name, root.children[position].name end end @@ -160,7 +160,7 @@ describe Redmine::MenuManager::Mapper do it 'should delete' do menu_mapper = Redmine::MenuManager::Mapper.new(:test_menu, {}) menu_mapper.push :test_overview, { controller: 'projects', action: 'show' }, {} - assert_not_nil menu_mapper.delete(:test_overview) + refute_nil menu_mapper.delete(:test_overview) assert_nil menu_mapper.find(:test_overview) end diff --git a/spec/legacy/unit/mail_handler_spec.rb b/spec/legacy/unit/mail_handler_spec.rb index 92b0d4b79e..f95108ded4 100644 --- a/spec/legacy/unit/mail_handler_spec.rb +++ b/spec/legacy/unit/mail_handler_spec.rb @@ -65,7 +65,7 @@ describe MailHandler, type: :model do assert !issue.description.match(/^Start Date:/i) # Email notification should be sent mail = ActionMailer::Base.deliveries.last - assert_not_nil mail + refute_nil mail assert mail.subject.include?('New ticket on a given project') end diff --git a/spec/legacy/unit/project_spec.rb b/spec/legacy/unit/project_spec.rb index f4ac99999b..db75e4e638 100644 --- a/spec/legacy/unit/project_spec.rb +++ b/spec/legacy/unit/project_spec.rb @@ -736,12 +736,12 @@ describe Project, type: :model do it 'should close completed versions' do Version.update_all("status = 'open'") project = Project.find(1) - assert_not_nil project.versions.detect { |v| v.completed? && v.status == 'open' } - assert_not_nil project.versions.detect { |v| !v.completed? && v.status == 'open' } + refute_nil project.versions.detect { |v| v.completed? && v.status == 'open' } + refute_nil project.versions.detect { |v| !v.completed? && v.status == 'open' } project.close_completed_versions project.reload assert_nil project.versions.detect { |v| v.completed? && v.status != 'closed' } - assert_not_nil project.versions.detect { |v| !v.completed? && v.status == 'open' } + refute_nil project.versions.detect { |v| !v.completed? && v.status == 'open' } end it 'should export work packages is allowed' do @@ -800,7 +800,7 @@ describe Project, type: :model do assert copied_issue assert copied_issue.fixed_version assert_equal 'Assigned Issues', copied_issue.fixed_version.name # Same name - assert_not_equal assigned_version.id, copied_issue.fixed_version.id # Different record + refute_equal assigned_version.id, copied_issue.fixed_version.id # Different record end it 'should change the new issues to use the copied closed version' do @@ -822,7 +822,7 @@ describe Project, type: :model do assert copied_issue assert copied_issue.fixed_version assert_equal 'Assigned Issues', copied_issue.fixed_version.name # Same name - assert_not_equal assigned_version.id, copied_issue.fixed_version.id # Different record + refute_equal assigned_version.id, copied_issue.fixed_version.id # Different record end it 'should copy issue relations' do @@ -850,14 +850,14 @@ describe Project, type: :model do copied_relation = copied_issue.relations.first assert_equal 'relates', copied_relation.relation_type assert_equal copied_second_issue.id, copied_relation.to_id - assert_not_equal source_relation.id, copied_relation.id + refute_equal source_relation.id, copied_relation.id # Second issue with a cross project relation assert_equal 2, copied_second_issue.relations.size, 'Relation not copied' copied_relation = copied_second_issue.relations.find { |r| r.relation_type == 'duplicates' } assert_equal 'duplicates', copied_relation.relation_type assert_equal 1, copied_relation.from_id, 'Cross project relation not kept' - assert_not_equal source_relation_cross_project.id, copied_relation.id + refute_equal source_relation_cross_project.id, copied_relation.id end it 'should copy memberships' do @@ -891,7 +891,7 @@ describe Project, type: :model do assert @project.copy(@source_project) member = Member.find_by(user_id: user.id, project_id: @project.id) - assert_not_nil member + refute_nil member assert_equal [1, 2], member.role_ids.sort end @@ -927,7 +927,7 @@ describe Project, type: :model do end assert @project.wiki - assert_not_equal @source_project.wiki, @project.wiki + refute_equal @source_project.wiki, @project.wiki assert_equal 'Start page', @project.wiki.start_page end @@ -978,7 +978,7 @@ describe Project, type: :model do @project.work_packages.each do |issue| assert issue.category assert_equal 'Stock management', issue.category.name # Same name - assert_not_equal Category.find(3), issue.category # Different record + refute_equal Category.find(3), issue.category # Different record end end diff --git a/spec/legacy/unit/query_spec.rb b/spec/legacy/unit/query_spec.rb index a9ed6e0de8..8999dc7a4a 100644 --- a/spec/legacy/unit/query_spec.rb +++ b/spec/legacy/unit/query_spec.rb @@ -48,7 +48,7 @@ describe Query, type: :model do # User.current should be anonymous here query = Query.new(project: nil, name: '_') project_filter = query.available_work_package_filters['project_id'] - assert_not_nil project_filter + refute_nil project_filter project_ids = project_filter[:values].map { |p| p[1] } assert project_ids.include?('1') # public project assert !project_ids.include?('2') # private project anonymous user cannot see @@ -235,7 +235,7 @@ describe Query, type: :model do User.current = User.find(1) query = Query.new(name: '_', filters: [Queries::WorkPackages::Filter.new(:watcher_id, operator: '=', values: ['me'])]) result = find_issues_with_query(query) - assert_not_nil result + refute_nil result assert !result.empty? assert_equal WorkPackage.visible.watched_by(User.current).sort_by(&:id), result.sort_by(&:id) User.current = nil @@ -245,7 +245,7 @@ describe Query, type: :model do User.current = User.find(1) query = Query.new(name: '_', filters: [Queries::WorkPackages::Filter.new(:watcher_id, operator: '!', values: ['me'])]) result = find_issues_with_query(query) - assert_not_nil result + refute_nil result assert !result.empty? assert_equal((WorkPackage.visible - WorkPackage.watched_by(User.current)).sort_by(&:id).size, result.sort_by(&:id).size) User.current = nil @@ -272,9 +272,9 @@ describe Query, type: :model do it 'should grouped with valid column' do q = Query.new(group_by: 'status', name: '_') assert q.grouped? - assert_not_nil q.group_by_column + refute_nil q.group_by_column assert_equal :status, q.group_by_column.name - assert_not_nil q.group_by_statement + refute_nil q.group_by_statement assert_equal 'status', q.group_by_statement end @@ -427,13 +427,13 @@ describe Query, type: :model do it 'should include users of visible projects in cross-project view' do users = @query.available_work_package_filters['assigned_to_id'] - assert_not_nil users + refute_nil users assert users[:values].map { |u| u[1] }.include?('3') end it 'should include visible projects in cross-project view' do projects = @query.available_work_package_filters['project_id'] - assert_not_nil projects + refute_nil projects assert projects[:values].map { |u| u[1] }.include?('1') end diff --git a/spec/legacy/unit/repository_spec.rb b/spec/legacy/unit/repository_spec.rb index da979020d8..d3134664b8 100644 --- a/spec/legacy/unit/repository_spec.rb +++ b/spec/legacy/unit/repository_spec.rb @@ -130,7 +130,7 @@ describe Repository, type: :model do comments: comment, commit_date: Time.now, revision: 0, scmid: 'f39b7922fb3c', committer: 'foo ', committed_on: Time.now, repository: repository) assert(changeset.save) - assert_not_equal(comment, changeset.comments) + refute_equal(comment, changeset.comments) assert_equal('This is a looooooooooooooong comment', changeset.comments) end diff --git a/spec/legacy/unit/repository_subversion_spec.rb b/spec/legacy/unit/repository_subversion_spec.rb index 300b9ef617..fb6b5f84d3 100644 --- a/spec/legacy/unit/repository_subversion_spec.rb +++ b/spec/legacy/unit/repository_subversion_spec.rb @@ -83,7 +83,7 @@ describe Repository::Subversion, type: :model do @repository.reload entries = @repository.entries('subversion_test/[folder_with_brackets]') - assert_not_nil entries, 'Expect to find entries in folder_with_brackets' + refute_nil entries, 'Expect to find entries in folder_with_brackets' assert_equal 1, entries.size, 'Expect one entry in folder_with_brackets' assert_equal 'README.txt', entries.first.name end @@ -102,7 +102,7 @@ describe Repository::Subversion, type: :model do assert_equal 2, @repository.file_changes.count, 'Expected to see 2 changes, dir add and file add' entries = @repository.entries('') - assert_not_nil entries, 'Expect to find entries' + refute_nil entries, 'Expect to find entries' assert_equal 1, entries.size, 'Expect a single entry' assert_equal 'README.txt', entries.first.name end diff --git a/spec/legacy/unit/token_spec.rb b/spec/legacy/unit/token_spec.rb index 0af172b96a..ec224f2bf9 100644 --- a/spec/legacy/unit/token_spec.rb +++ b/spec/legacy/unit/token_spec.rb @@ -42,7 +42,7 @@ describe Token do user = User.find(1) t1 = Token.create(user: user, action: 'autologin') t2 = Token.create(user: user, action: 'autologin') - assert_not_equal t1.value, t2.value + refute_equal t1.value, t2.value assert !Token.exists?(t1.id) assert Token.exists?(t2.id) end diff --git a/spec/legacy/unit/user_spec.rb b/spec/legacy/unit/user_spec.rb index 181565a50d..fecbe8e53e 100644 --- a/spec/legacy/unit/user_spec.rb +++ b/spec/legacy/unit/user_spec.rb @@ -400,7 +400,7 @@ describe User, type: :model do it 'should find by mail should be case insensitive' do u = User.find_by_mail('JSmith@somenet.foo') - assert_not_nil u + refute_nil u assert_equal 'jsmith@somenet.foo', u.mail end diff --git a/spec/legacy/unit/wiki_page_spec.rb b/spec/legacy/unit/wiki_page_spec.rb index a57e11b7ed..9badbce904 100644 --- a/spec/legacy/unit/wiki_page_spec.rb +++ b/spec/legacy/unit/wiki_page_spec.rb @@ -140,7 +140,7 @@ describe WikiPage, type: :model do it 'should updated on eager load' do page = WikiPage.with_updated_on.first assert page.is_a?(WikiPage) - assert_not_nil page.read_attribute(:updated_on) + refute_nil page.read_attribute(:updated_on) assert_equal page.content.updated_on, page.updated_on end end