Commit 0bb637b29eb18129de97125ff4bcd7abc7978c1d

Authored by Braulio Bhavamitra
1 parent b3d6f944

rails4: rename remaining old named_scope

plugins/bsc/lib/bsc_plugin/contract.rb
@@ -8,8 +8,8 @@ class BscPlugin::Contract < ActiveRecord::Base @@ -8,8 +8,8 @@ class BscPlugin::Contract < ActiveRecord::Base
8 8
9 belongs_to :bsc, :class_name => 'BscPlugin::Bsc' 9 belongs_to :bsc, :class_name => 'BscPlugin::Bsc'
10 10
11 - named_scope :status, -> status_list { where 'status in (?)', status_list if status_list.present? }  
12 - named_scope :sorted_by, -> sorter, direction { order "#{sorter} #{direction}" } 11 + scope :status, -> status_list { where 'status in (?)', status_list if status_list.present? }
  12 + scope :sorted_by, -> sorter, direction { order "#{sorter} #{direction}" }
13 13
14 before_create do |contract| 14 before_create do |contract|
15 contract.created_at ||= Time.now.utc 15 contract.created_at ||= Time.now.utc
plugins/bsc/lib/bsc_plugin/ext/enterprise.rb
@@ -8,6 +8,6 @@ class Enterprise @@ -8,6 +8,6 @@ class Enterprise
8 FIELDS << 'enabled' 8 FIELDS << 'enabled'
9 FIELDS << 'validated' 9 FIELDS << 'validated'
10 10
11 - named_scope :validated, -> { where validated: true }  
12 - named_scope :not_validated, -> { where validated: false } 11 + scope :validated, -> { where validated: true }
  12 + scope :not_validated, -> { where validated: false }
13 end 13 end
test/unit/category_test.rb
@@ -497,7 +497,7 @@ class CategoryTest &lt; ActiveSupport::TestCase @@ -497,7 +497,7 @@ class CategoryTest &lt; ActiveSupport::TestCase
497 assert_includes Category.on_level(c3), c6 497 assert_includes Category.on_level(c3), c6
498 end 498 end
499 499
500 - should 'on level named_scope must be able to receive parent or parent_id' do 500 + should 'on level scope must be able to receive parent or parent_id' do
501 parent = fast_create(Category) 501 parent = fast_create(Category)
502 category = fast_create(Category, :parent_id => parent) 502 category = fast_create(Category, :parent_id => parent)
503 503
test/unit/person_test.rb
@@ -1372,7 +1372,7 @@ class PersonTest &lt; ActiveSupport::TestCase @@ -1372,7 +1372,7 @@ class PersonTest &lt; ActiveSupport::TestCase
1372 assert_includes non_abusers, not_abuser 1372 assert_includes non_abusers, not_abuser
1373 end 1373 end
1374 1374
1375 - should 'admins named_scope return persons who are admin users' do 1375 + should 'admins scope return persons who are admin users' do
1376 Person.delete_all 1376 Person.delete_all
1377 e = Environment.default 1377 e = Environment.default
1378 admins = [] 1378 admins = []
@@ -1387,7 +1387,7 @@ class PersonTest &lt; ActiveSupport::TestCase @@ -1387,7 +1387,7 @@ class PersonTest &lt; ActiveSupport::TestCase
1387 assert_equivalent admins, Person.admins 1387 assert_equivalent admins, Person.admins
1388 end 1388 end
1389 1389
1390 - should 'activated named_scope return persons who are activated users' do 1390 + should 'activated scope return persons who are activated users' do
1391 Person.delete_all 1391 Person.delete_all
1392 e = Environment.default 1392 e = Environment.default
1393 activated = [] 1393 activated = []
@@ -1403,7 +1403,7 @@ class PersonTest &lt; ActiveSupport::TestCase @@ -1403,7 +1403,7 @@ class PersonTest &lt; ActiveSupport::TestCase
1403 assert_equivalent activated, Person.activated 1403 assert_equivalent activated, Person.activated
1404 end 1404 end
1405 1405
1406 - should 'deactivated named_scope return persons who are deactivated users' do 1406 + should 'deactivated scope return persons who are deactivated users' do
1407 Person.delete_all 1407 Person.delete_all
1408 e = Environment.default 1408 e = Environment.default
1409 deactivated = [] 1409 deactivated = []
test/unit/task_test.rb
@@ -317,7 +317,7 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -317,7 +317,7 @@ class TaskTest &lt; ActiveSupport::TestCase
317 assert_includes Task.to(another_person), t4 317 assert_includes Task.to(another_person), t4
318 end 318 end
319 319
320 - should 'filter tasks by type with named_scope' do 320 + should 'filter tasks by type with scope' do
321 class CleanHouse < Task; end 321 class CleanHouse < Task; end
322 class FeedDog < Task; end 322 class FeedDog < Task; end
323 requestor = fast_create(Person) 323 requestor = fast_create(Person)