mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add cop for preferring 'Foo.method' over 'Foo::method'
This commit is contained in:
parent
a5e81342af
commit
9c0c90979a
4 changed files with 7 additions and 3 deletions
|
@ -156,3 +156,7 @@ Style/RedundantReturn:
|
||||||
Style/Semicolon:
|
Style/Semicolon:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
AllowAsExpressionSeparator: true
|
AllowAsExpressionSeparator: true
|
||||||
|
|
||||||
|
# Prefer Foo.method over Foo::method
|
||||||
|
Style/ColonMethodCall:
|
||||||
|
Enabled: true
|
||||||
|
|
|
@ -1186,7 +1186,7 @@ class CustomNameForFixtureOrModelTest < ActiveRecord::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_table_name_is_defined_in_the_model
|
def test_table_name_is_defined_in_the_model
|
||||||
assert_equal "randomly_named_table2", ActiveRecord::FixtureSet::all_loaded_fixtures["admin/randomly_named_a9"].table_name
|
assert_equal "randomly_named_table2", ActiveRecord::FixtureSet.all_loaded_fixtures["admin/randomly_named_a9"].table_name
|
||||||
assert_equal "randomly_named_table2", Admin::ClassNameThatDoesNotFollowCONVENTIONS1.table_name
|
assert_equal "randomly_named_table2", Admin::ClassNameThatDoesNotFollowCONVENTIONS1.table_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ApiAppGeneratorTest < Rails::Generators::TestCase
|
||||||
Rails.application = TestApp::Application
|
Rails.application = TestApp::Application
|
||||||
super
|
super
|
||||||
|
|
||||||
Kernel::silence_warnings do
|
Kernel.silence_warnings do
|
||||||
Thor::Base.shell.send(:attr_accessor, :always_force)
|
Thor::Base.shell.send(:attr_accessor, :always_force)
|
||||||
@shell = Thor::Base.shell.new
|
@shell = Thor::Base.shell.new
|
||||||
@shell.send(:always_force=, true)
|
@shell.send(:always_force=, true)
|
||||||
|
|
|
@ -9,7 +9,7 @@ module SharedGeneratorTests
|
||||||
super
|
super
|
||||||
Rails::Generators::AppGenerator.instance_variable_set("@desc", nil)
|
Rails::Generators::AppGenerator.instance_variable_set("@desc", nil)
|
||||||
|
|
||||||
Kernel::silence_warnings do
|
Kernel.silence_warnings do
|
||||||
Thor::Base.shell.send(:attr_accessor, :always_force)
|
Thor::Base.shell.send(:attr_accessor, :always_force)
|
||||||
@shell = Thor::Base.shell.new
|
@shell = Thor::Base.shell.new
|
||||||
@shell.send(:always_force=, true)
|
@shell.send(:always_force=, true)
|
||||||
|
|
Loading…
Reference in a new issue