diff options
-rw-r--r-- | .rubocop_todo.yml | 14 | ||||
-rw-r--r-- | app/controllers/enumerations_controller.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | test/functional/documents_controller_test.rb | 6 | ||||
-rw-r--r-- | test/functional/journals_controller_test.rb | 2 | ||||
-rw-r--r-- | test/functional/search_controller_test.rb | 4 | ||||
-rw-r--r-- | test/unit/document_category_test.rb | 2 | ||||
-rw-r--r-- | test/unit/document_test.rb | 2 | ||||
-rw-r--r-- | test/unit/enumeration_test.rb | 8 | ||||
-rw-r--r-- | test/unit/issue_subtasking_test.rb | 2 | ||||
-rw-r--r-- | test/unit/message_test.rb | 2 |
11 files changed, 16 insertions, 30 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 272fa92d7..735b9bf54 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -818,20 +818,6 @@ Naming/VariableNumber: - 'test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb' - 'test/unit/project_test.rb' -# Cop supports --auto-correct. -Rails/ActiveRecordAliases: - Exclude: - - 'app/controllers/enumerations_controller.rb' - - 'app/models/project.rb' - - 'test/functional/documents_controller_test.rb' - - 'test/functional/journals_controller_test.rb' - - 'test/functional/search_controller_test.rb' - - 'test/unit/document_category_test.rb' - - 'test/unit/document_test.rb' - - 'test/unit/enumeration_test.rb' - - 'test/unit/issue_subtasking_test.rb' - - 'test/unit/message_test.rb' - # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/ActiveRecordOverride: diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 0936d9fd9..ed5a0e636 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -59,7 +59,7 @@ class EnumerationsController < ApplicationController end def update - if @enumeration.update_attributes(enumeration_params) + if @enumeration.update(enumeration_params) respond_to do |format| format.html { flash[:notice] = l(:notice_successful_update) diff --git a/app/models/project.rb b/app/models/project.rb index efdf711c7..30f3be5ba 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -275,7 +275,7 @@ class Project < ActiveRecord::Base self.create_time_entry_activity_if_needed(activity_hash) else activity = project.time_entry_activities.find_by_id(id.to_i) - activity.update_attributes(activity_hash) if activity + activity.update(activity_hash) if activity end end diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index c0e9e3e26..d0e586649 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -31,7 +31,7 @@ class DocumentsControllerTest < Redmine::ControllerTest def test_index # Sets a default category e = Enumeration.find_by_name('Technical documentation') - e.update_attributes(:is_default => true) + e.update(:is_default => true) get :index, :params => { :project_id => 'ecookbook' @@ -106,7 +106,7 @@ class DocumentsControllerTest < Redmine::ControllerTest def test_index_with_long_description # adds a long description to the first document doc = documents(:documents_001) - doc.update_attributes(:description => <<LOREM) + doc.update(:description => <<LOREM) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas, mi vehicula varius varius, ipsum massa fermentum orci, eget tristique ante sem vel mi. Nulla facilisi. Donec enim libero, luctus ac sagittis sit amet, vehicula sagittis magna. Duis ultrices molestie ante, eget scelerisque sem iaculis vitae. Etiam fermentum mauris vitae metus pharetra condimentum fermentum est pretium. Proin sollicitudin elementum quam quis pharetra. Aenean facilisis nunc quis elit volutpat mollis. Aenean eleifend varius euismod. Ut dolor est, congue eget dapibus eget, elementum eu odio. Integer et lectus neque, nec scelerisque nisi. EndOfLineHere Vestibulum non velit mi. Aliquam scelerisque libero ut nulla fringilla a sollicitudin magna rhoncus. Praesent a nunc lorem, ac porttitor eros. Sed ac diam nec neque interdum adipiscing quis quis justo. Donec arcu nunc, fringilla eu dictum at, venenatis ac sem. Vestibulum quis elit urna, ac mattis sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. @@ -183,7 +183,7 @@ LOREM def test_create_non_default_category @request.session[:user_id] = 2 category2 = Enumeration.find_by_name('User documentation') - category2.update_attributes(:is_default => true) + category2.update(:is_default => true) category1 = Enumeration.find_by_name('Uncategorized') post :create, :params => { :project_id => 'ecookbook', diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index c2a21bc5d..b003a3659 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.rb @@ -278,7 +278,7 @@ class JournalsControllerTest < Redmine::ControllerTest end def test_update_xhr_with_private_notes_unchecked - Journal.find(2).update_attributes(:private_notes => true) + Journal.find(2).update(:private_notes => true) @request.session[:user_id] = 1 post :update, :params => { :id => 2, diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index b84ce2795..77286ed42 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -410,7 +410,7 @@ class SearchControllerTest < Redmine::ControllerTest end def test_results_should_be_escaped_once - assert Issue.find(1).update_attributes(:subject => '<subject> escaped_once', :description => '<description> escaped_once') + assert Issue.find(1).update(:subject => '<subject> escaped_once', :description => '<description> escaped_once') get :index, :params => {:q => 'escaped_once'} assert_response :success assert_select '#search-results' do @@ -420,7 +420,7 @@ class SearchControllerTest < Redmine::ControllerTest end def test_keywords_should_be_highlighted - assert Issue.find(1).update_attributes(:subject => 'subject highlighted', :description => 'description highlighted') + assert Issue.find(1).update(:subject => 'subject highlighted', :description => 'description highlighted') get :index, :params => {:q => 'highlighted'} assert_response :success assert_select '#search-results' do diff --git a/test/unit/document_category_test.rb b/test/unit/document_category_test.rb index 4233c03db..bf91c1b42 100644 --- a/test/unit/document_category_test.rb +++ b/test/unit/document_category_test.rb @@ -42,7 +42,7 @@ class DocumentCategoryTest < ActiveSupport::TestCase def test_default assert_nil DocumentCategory.where(:is_default => true).first e = Enumeration.find_by_name('Technical documentation') - e.update_attributes(:is_default => true) + e.update(:is_default => true) assert_equal 3, DocumentCategory.default.id end diff --git a/test/unit/document_test.rb b/test/unit/document_test.rb index 7a7cff79c..5a2651a49 100644 --- a/test/unit/document_test.rb +++ b/test/unit/document_test.rb @@ -53,7 +53,7 @@ class DocumentTest < ActiveSupport::TestCase def test_create_with_default_category # Sets a default category e = Enumeration.find_by_name('Technical documentation') - e.update_attributes(:is_default => true) + e.update(:is_default => true) doc = Document.new(:project => Project.find(1), :title => 'New document') assert_equal e, doc.category diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb index c8f79ed09..9c1934fb6 100644 --- a/test/unit/enumeration_test.rb +++ b/test/unit/enumeration_test.rb @@ -53,7 +53,7 @@ class EnumerationTest < ActiveSupport::TestCase assert e.is_a?(Enumeration) assert e.is_default? assert e.active? - e.update_attributes(:active => false) + e.update(:active => false) assert e.is_default? assert !e.active? end @@ -74,19 +74,19 @@ class EnumerationTest < ActiveSupport::TestCase def test_update_default e = Enumeration.default - e.update_attributes(:name => 'Changed', :is_default => true) + e.update(:name => 'Changed', :is_default => true) assert_equal e, Enumeration.default end def test_update_default_to_non_default e = Enumeration.default - e.update_attributes(:name => 'Changed', :is_default => false) + e.update(:name => 'Changed', :is_default => false) assert_nil Enumeration.default end def test_change_default e = Enumeration.find_by_name('Default Enumeration') - e.update_attributes(:name => 'Changed Enumeration', :is_default => true) + e.update(:name => 'Changed Enumeration', :is_default => true) assert_equal e, Enumeration.default end diff --git a/test/unit/issue_subtasking_test.rb b/test/unit/issue_subtasking_test.rb index 51d30d7e9..3deb9561e 100644 --- a/test/unit/issue_subtasking_test.rb +++ b/test/unit/issue_subtasking_test.rb @@ -249,7 +249,7 @@ class IssueSubtaskingTest < ActiveSupport::TestCase child = first_parent.generate_child!(:done_ratio => 20) assert_equal 30, first_parent.reload.done_ratio assert_equal 0, second_parent.reload.done_ratio - child.update_attributes(:parent_issue_id => second_parent.id) + child.update(:parent_issue_id => second_parent.id) assert_equal 40, first_parent.reload.done_ratio assert_equal 20, second_parent.reload.done_ratio end diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 172f6d92b..5bbb2190c 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -99,7 +99,7 @@ class MessageTest < ActiveSupport::TestCase # New board assert_difference 'Board.find(2).topics_count' do assert_difference 'Board.find(2).messages_count', (1 + message.replies_count) do - message.update_attributes(:board_id => 2) + message.update(:board_id => 2) end end end |