From efe01800309e3328a2837b61b87f82d2c7816235 Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Mon, 16 Jun 2014 17:03:46 -0300 Subject: [PATCH] removing trailing whitespaces --- vendor/plugins/acts_as_list/lib/active_record/acts/list.rb | 8 ++++---- vendor/plugins/acts_as_list/test/list_test.rb | 77 ++++++++++++++++++++++++++++++++++++++--------------------------------------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb b/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb index ee96ea1..65790f9 100644 --- a/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +++ b/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb @@ -26,8 +26,8 @@ module ActiveRecord # Configuration options are: # # * +column+ - specifies the column name to use for keeping the position integer (default: +position+) - # * +scope+ - restricts what is to be considered a list. Given a symbol, it'll attach _id - # (if it hasn't already been added) and use that as the foreign key restriction. It's also possible + # * +scope+ - restricts what is to be considered a list. Given a symbol, it'll attach _id + # (if it hasn't already been added) and use that as the foreign key restriction. It's also possible # to give it an entire string that is interpolated if you need a tighter scope than just a foreign key. # Example: acts_as_list :scope => 'todo_list_id = #{todo_list_id} AND completed = 0' def acts_as_list(options = {}) @@ -45,7 +45,7 @@ module ActiveRecord elsif configuration[:scope].is_a?(Array) scope_condition_method = %( def scope_condition - attrs = %w(#{configuration[:scope].join(" ")}).inject({}) do |memo,column| + attrs = %w(#{configuration[:scope].join(" ")}).inject({}) do |memo,column| memo[column.intern] = send(column.intern); memo end self.class.send(:sanitize_sql_hash_for_conditions, attrs) @@ -255,7 +255,7 @@ module ActiveRecord increment_positions_on_lower_items(position) self.update_attribute(position_column, position) end - end + end end end end diff --git a/vendor/plugins/acts_as_list/test/list_test.rb b/vendor/plugins/acts_as_list/test/list_test.rb index 81eccd6..a99451c 100644 --- a/vendor/plugins/acts_as_list/test/list_test.rb +++ b/vendor/plugins/acts_as_list/test/list_test.rb @@ -14,7 +14,7 @@ def setup_db t.column :pos, :integer t.column :parent_id, :integer t.column :parent_type, :string - t.column :created_at, :datetime + t.column :created_at, :datetime t.column :updated_at, :datetime end end @@ -194,38 +194,38 @@ class ListTest < Test::Unit::TestCase assert_equal [new2, new1, new3], ListMixin.find(:all, :conditions => 'parent_id IS NULL', :order => 'pos') end - def test_remove_from_list_should_then_fail_in_list? + def test_remove_from_list_should_then_fail_in_list? assert_equal true, ListMixin.find(1).in_list? ListMixin.find(1).remove_from_list assert_equal false, ListMixin.find(1).in_list? - end - - def test_remove_from_list_should_set_position_to_nil + end + + def test_remove_from_list_should_set_position_to_nil assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id) - - ListMixin.find(2).remove_from_list - + + ListMixin.find(2).remove_from_list + assert_equal [2, 1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id) - + assert_equal 1, ListMixin.find(1).pos assert_equal nil, ListMixin.find(2).pos assert_equal 2, ListMixin.find(3).pos assert_equal 3, ListMixin.find(4).pos - end - - def test_remove_before_destroy_does_not_shift_lower_items_twice + end + + def test_remove_before_destroy_does_not_shift_lower_items_twice assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id) - - ListMixin.find(2).remove_from_list - ListMixin.find(2).destroy - + + ListMixin.find(2).remove_from_list + ListMixin.find(2).destroy + assert_equal [1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id) - + assert_equal 1, ListMixin.find(1).pos assert_equal 2, ListMixin.find(3).pos assert_equal 3, ListMixin.find(4).pos - end - + end + def test_before_destroy_callbacks_do_not_update_position_to_nil_before_deleting_the_record assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id) @@ -484,38 +484,37 @@ class ArrayScopeListTest < Test::Unit::TestCase assert_equal 1, ArrayScopeListMixin.find(3).pos assert_equal 2, ArrayScopeListMixin.find(4).pos end - - def test_remove_from_list_should_then_fail_in_list? + + def test_remove_from_list_should_then_fail_in_list? assert_equal true, ArrayScopeListMixin.find(1).in_list? ArrayScopeListMixin.find(1).remove_from_list assert_equal false, ArrayScopeListMixin.find(1).in_list? - end - - def test_remove_from_list_should_set_position_to_nil + end + + def test_remove_from_list_should_set_position_to_nil assert_equal [1, 2, 3, 4], ArrayScopeListMixin.find(:all, :conditions => "parent_id = 5 AND parent_type = 'ParentClass'", :order => 'pos').map(&:id) - - ArrayScopeListMixin.find(2).remove_from_list - + + ArrayScopeListMixin.find(2).remove_from_list + assert_equal [2, 1, 3, 4], ArrayScopeListMixin.find(:all, :conditions => "parent_id = 5 AND parent_type = 'ParentClass'", :order => 'pos').map(&:id) - + assert_equal 1, ArrayScopeListMixin.find(1).pos assert_equal nil, ArrayScopeListMixin.find(2).pos assert_equal 2, ArrayScopeListMixin.find(3).pos assert_equal 3, ArrayScopeListMixin.find(4).pos - end - - def test_remove_before_destroy_does_not_shift_lower_items_twice + end + + def test_remove_before_destroy_does_not_shift_lower_items_twice assert_equal [1, 2, 3, 4], ArrayScopeListMixin.find(:all, :conditions => "parent_id = 5 AND parent_type = 'ParentClass'", :order => 'pos').map(&:id) - - ArrayScopeListMixin.find(2).remove_from_list - ArrayScopeListMixin.find(2).destroy - + + ArrayScopeListMixin.find(2).remove_from_list + ArrayScopeListMixin.find(2).destroy + assert_equal [1, 3, 4], ArrayScopeListMixin.find(:all, :conditions => "parent_id = 5 AND parent_type = 'ParentClass'", :order => 'pos').map(&:id) - + assert_equal 1, ArrayScopeListMixin.find(1).pos assert_equal 2, ArrayScopeListMixin.find(3).pos assert_equal 3, ArrayScopeListMixin.find(4).pos - end - -end + end +end -- libgit2 0.21.2