1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #33949 from sjain1107/no-private-def

Remove private def
This commit is contained in:
Kasper Timm Hansen 2018-09-23 19:39:15 +02:00 committed by GitHub
commit 22dc2b3db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 85 additions and 70 deletions

View file

@ -26,16 +26,17 @@ module ActionCable::StreamTests
transmit_subscription_confirmation
end
private def pick_coder(coder)
case coder
when nil, "json"
ActiveSupport::JSON
when "custom"
DummyEncoder
when "none"
nil
private
def pick_coder(coder)
case coder
when nil, "json"
ActiveSupport::JSON
when "custom"
DummyEncoder
when "none"
nil
end
end
end
end
module DummyEncoder

View file

@ -36,12 +36,14 @@ ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
# Skips the current run on Rubinius using Minitest::Assertions#skip
private def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
private def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
end

View file

@ -430,14 +430,16 @@ end
class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
# Skips the current run on Rubinius using Minitest::Assertions#skip
private def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
private def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
end
class DrivenByRackTest < ActionDispatch::SystemTestCase

View file

@ -32,10 +32,11 @@ module RenderContext
"controller context!"
end
# 3) Set view_context to self
private def view_context
self
end
private
# 3) Set view_context to self
def view_context
self
end
end
class RenderContextTest < Rack::TestCase

View file

@ -225,12 +225,14 @@ class ActiveSupport::TestCase
include ActionDispatch::DrawOnce
include ActiveSupport::Testing::MethodCallAssertions
# Skips the current run on Rubinius using Minitest::Assertions#skip
private def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
private def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
end

View file

@ -450,13 +450,15 @@ class FormWithActsLikeFormForTest < FormWithTest
def test_form_with_doesnt_call_private_or_protected_properties_on_form_object_skipping_value
obj = Class.new do
private def private_property
"That would be great."
end
private
def private_property
"That would be great."
end
protected def protected_property
"I believe you have my stapler."
end
protected
def protected_property
"I believe you have my stapler."
end
end.new
form_with(model: obj, scope: "other_name", url: "/", id: "edit-other-name") do |f|

View file

@ -14,12 +14,14 @@ require "active_support/testing/method_call_assertions"
class ActiveModel::TestCase < ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
# Skips the current run on Rubinius using Minitest::Assertions#skip
private def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
private def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
end

View file

@ -29,17 +29,18 @@ I18n.enforce_available_locales = false
class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
# Skips the current run on Rubinius using Minitest::Assertions#skip
private def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
private def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
def frozen_error_class
Object.const_defined?(:FrozenError) ? FrozenError : RuntimeError
end
def frozen_error_class
Object.const_defined?(:FrozenError) ? FrozenError : RuntimeError
end
end

View file

@ -21,12 +21,14 @@ end
class ActiveSupport::TestCase
include ActiveSupport::Testing::Stream
# Skips the current run on Rubinius using Minitest::Assertions#skip
private def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
private def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)
end
end