Enforce Rails-style (line-count-based) block style

This commit is contained in:
Benjamin Fleischer
2015-09-20 17:56:06 -05:00
parent aaa60bfdc1
commit ca6b193fcb
7 changed files with 23 additions and 28 deletions

View File

@@ -400,25 +400,25 @@ module ActionController
end
def test_warn_overridding_use_adapter_as_falsy_on_controller_instance
controller = Class.new(ImplicitSerializationTestController) {
controller = Class.new(ImplicitSerializationTestController) do
def use_adapter?
false
end
}.new
assert_match(/adapter: false/, (capture(:stderr) {
end.new
assert_match(/adapter: false/, (capture(:stderr) do
controller.get_serializer(Profile.new)
}))
end))
end
def test_dont_warn_overridding_use_adapter_as_truthy_on_controller_instance
controller = Class.new(ImplicitSerializationTestController) {
controller = Class.new(ImplicitSerializationTestController) do
def use_adapter?
true
end
}.new
assert_equal '', (capture(:stderr) {
end.new
assert_equal '', (capture(:stderr) do
controller.get_serializer(Profile.new)
})
end)
end
end
end

View File

@@ -28,9 +28,9 @@ class CaptureWarnings
# rubocop:disable Metrics/AbcSize
def after_tests(lines)
app_warnings, other_warnings = lines.partition { |line|
app_warnings, other_warnings = lines.partition do |line|
line.include?(app_root) && !line.include?(bundle_dir)
}
end
header = "#{'-' * 22} app warnings: #{'-' * 22}"
output.puts