From 198570db2c57e2528d4c06de575b2d80eda31186 Mon Sep 17 00:00:00 2001 From: Sergey Kuchmistov Date: Tue, 24 Jun 2014 18:57:52 +0300 Subject: [PATCH] Prefer protected over private attributes --- lib/shoulda/matchers/action_controller/callback_matcher.rb | 2 +- lib/shoulda/matchers/action_controller/rescue_from_matcher.rb | 2 +- lib/shoulda/matchers/action_controller/route_params.rb | 2 +- .../matchers/action_controller/strong_parameters_matcher.rb | 2 +- lib/shoulda/matchers/active_model/allow_value_matcher.rb | 2 +- lib/shoulda/matchers/active_model/disallow_value_matcher.rb | 2 +- .../matchers/active_model/have_secure_password_matcher.rb | 2 +- lib/shoulda/matchers/active_record/association_matcher.rb | 2 +- .../active_record/association_matchers/counter_cache_matcher.rb | 2 +- .../active_record/association_matchers/dependent_matcher.rb | 2 +- .../active_record/association_matchers/inverse_of_matcher.rb | 2 +- .../active_record/association_matchers/model_reflection.rb | 2 +- .../active_record/association_matchers/model_reflector.rb | 2 +- .../active_record/association_matchers/option_verifier.rb | 2 +- .../active_record/association_matchers/order_matcher.rb | 2 +- .../active_record/association_matchers/source_matcher.rb | 2 +- .../active_record/association_matchers/through_matcher.rb | 2 +- lib/shoulda/matchers/doublespeak/double.rb | 2 +- lib/shoulda/matchers/doublespeak/double_collection.rb | 2 +- lib/shoulda/matchers/doublespeak/object_double.rb | 2 +- lib/shoulda/matchers/doublespeak/proxy_implementation.rb | 2 +- lib/shoulda/matchers/doublespeak/stub_implementation.rb | 2 +- lib/shoulda/matchers/independent/delegate_matcher.rb | 2 +- .../matchers/independent/delegate_matcher/stubbed_target.rb | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/shoulda/matchers/action_controller/callback_matcher.rb b/lib/shoulda/matchers/action_controller/callback_matcher.rb index a6928297..13f7e5a1 100644 --- a/lib/shoulda/matchers/action_controller/callback_matcher.rb +++ b/lib/shoulda/matchers/action_controller/callback_matcher.rb @@ -180,7 +180,7 @@ module Shoulda "have :#{method_name} as a #{kind}_#{callback_type}" end - private + protected def callbacks controller_class._process_action_callbacks.select do |callback| diff --git a/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb b/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb index 54b55b57..5a22ca1b 100644 --- a/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +++ b/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb @@ -67,7 +67,7 @@ module Shoulda end alias failure_message_for_should_not failure_message_when_negated - private + protected attr_reader :controller, :exception, :expected_method, :handlers diff --git a/lib/shoulda/matchers/action_controller/route_params.rb b/lib/shoulda/matchers/action_controller/route_params.rb index 2c379446..8d7afb96 100644 --- a/lib/shoulda/matchers/action_controller/route_params.rb +++ b/lib/shoulda/matchers/action_controller/route_params.rb @@ -15,7 +15,7 @@ module Shoulda end end - private + protected attr_reader :args diff --git a/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb b/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb index 9329fc4e..13e065d7 100644 --- a/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb +++ b/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb @@ -206,7 +206,7 @@ module Shoulda end alias failure_message_for_should_not failure_message_when_negated - private + protected attr_reader :controller, :double_collection, :action, :verb, :request_params, :expected_permitted_params, :context diff --git a/lib/shoulda/matchers/active_model/allow_value_matcher.rb b/lib/shoulda/matchers/active_model/allow_value_matcher.rb index a71c006c..2ed8f8ab 100644 --- a/lib/shoulda/matchers/active_model/allow_value_matcher.rb +++ b/lib/shoulda/matchers/active_model/allow_value_matcher.rb @@ -237,7 +237,7 @@ module Shoulda message_finder.allow_description(allowed_values) end - private + protected attr_accessor :values_to_match, :message_finder_factory, :instance, :attribute_to_set, :attribute_to_check_message_against, diff --git a/lib/shoulda/matchers/active_model/disallow_value_matcher.rb b/lib/shoulda/matchers/active_model/disallow_value_matcher.rb index 066e1d64..9dc70980 100644 --- a/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +++ b/lib/shoulda/matchers/active_model/disallow_value_matcher.rb @@ -46,7 +46,7 @@ module Shoulda self end - private + protected attr_reader :allow_matcher end diff --git a/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb b/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb index b53d7fec..4adb998f 100644 --- a/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +++ b/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb @@ -68,7 +68,7 @@ module Shoulda failure.nil? end - private + protected attr_reader :subject diff --git a/lib/shoulda/matchers/active_record/association_matcher.rb b/lib/shoulda/matchers/active_record/association_matcher.rb index 101d4632..f3e083b8 100644 --- a/lib/shoulda/matchers/active_record/association_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matcher.rb @@ -855,7 +855,7 @@ module Shoulda submatchers_match? end - private + protected attr_reader :submatchers, :missing, :subject, :macro, :name, :options diff --git a/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb b/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb index f124752e..6866e3b9 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb @@ -27,7 +27,7 @@ module Shoulda end end - private + protected attr_accessor :subject, :counter_cache, :name diff --git a/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb b/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb index bff159f7..4c68364c 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb @@ -27,7 +27,7 @@ module Shoulda end end - private + protected attr_accessor :subject, :dependent, :name diff --git a/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb b/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb index 639cadc2..ae9a5656 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb @@ -27,7 +27,7 @@ module Shoulda end end - private + protected attr_accessor :subject, :inverse_of, :name diff --git a/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb b/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb index fe3bee59..fc6b38a0 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb @@ -45,7 +45,7 @@ module Shoulda end end - private + protected attr_reader :reflection, :subject diff --git a/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb b/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb index 7fb477a3..c9734bed 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb @@ -47,7 +47,7 @@ module Shoulda end end - private + protected attr_reader :subject, :name diff --git a/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb b/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb index e9ddc235..7c052294 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb @@ -43,7 +43,7 @@ module Shoulda end end - private + protected attr_reader :reflector diff --git a/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb b/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb index 0667c91d..08775955 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb @@ -27,7 +27,7 @@ module Shoulda end end - private + protected attr_accessor :subject, :order, :name diff --git a/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb b/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb index 6f7dffb6..7985b003 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb @@ -27,7 +27,7 @@ module Shoulda end end - private + protected attr_accessor :subject, :source, :name diff --git a/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb b/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb index d7b16308..0569394a 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb @@ -49,7 +49,7 @@ module Shoulda end end - private + protected attr_accessor :through, :name, :subject diff --git a/lib/shoulda/matchers/doublespeak/double.rb b/lib/shoulda/matchers/doublespeak/double.rb index 7fd7d2c8..754ad9bd 100644 --- a/lib/shoulda/matchers/doublespeak/double.rb +++ b/lib/shoulda/matchers/doublespeak/double.rb @@ -46,7 +46,7 @@ module Shoulda end end - private + protected attr_reader :klass, :method_name, :implementation, :original_method diff --git a/lib/shoulda/matchers/doublespeak/double_collection.rb b/lib/shoulda/matchers/doublespeak/double_collection.rb index 0c958cc3..77a0b07d 100644 --- a/lib/shoulda/matchers/doublespeak/double_collection.rb +++ b/lib/shoulda/matchers/doublespeak/double_collection.rb @@ -38,7 +38,7 @@ module Shoulda end end - private + protected attr_reader :klass, :doubles_by_method_name diff --git a/lib/shoulda/matchers/doublespeak/object_double.rb b/lib/shoulda/matchers/doublespeak/object_double.rb index 6789ca60..dbb2ee03 100644 --- a/lib/shoulda/matchers/doublespeak/object_double.rb +++ b/lib/shoulda/matchers/doublespeak/object_double.rb @@ -24,7 +24,7 @@ module Shoulda nil end - private + protected attr_reader :calls_by_method_name end diff --git a/lib/shoulda/matchers/doublespeak/proxy_implementation.rb b/lib/shoulda/matchers/doublespeak/proxy_implementation.rb index 80460c48..ad32e056 100644 --- a/lib/shoulda/matchers/doublespeak/proxy_implementation.rb +++ b/lib/shoulda/matchers/doublespeak/proxy_implementation.rb @@ -22,7 +22,7 @@ module Shoulda double.call_original_method(object, args, block) end - private + protected attr_reader :stub_implementation end diff --git a/lib/shoulda/matchers/doublespeak/stub_implementation.rb b/lib/shoulda/matchers/doublespeak/stub_implementation.rb index 18ec7f4a..2745a33a 100644 --- a/lib/shoulda/matchers/doublespeak/stub_implementation.rb +++ b/lib/shoulda/matchers/doublespeak/stub_implementation.rb @@ -26,7 +26,7 @@ module Shoulda implementation.call(object, args, block) end - private + protected attr_reader :implementation end diff --git a/lib/shoulda/matchers/independent/delegate_matcher.rb b/lib/shoulda/matchers/independent/delegate_matcher.rb index fed7620d..7f8028ab 100644 --- a/lib/shoulda/matchers/independent/delegate_matcher.rb +++ b/lib/shoulda/matchers/independent/delegate_matcher.rb @@ -171,7 +171,7 @@ module Shoulda end alias failure_message_for_should_not failure_message_when_negated - private + protected attr_reader \ :delegated_arguments, diff --git a/lib/shoulda/matchers/independent/delegate_matcher/stubbed_target.rb b/lib/shoulda/matchers/independent/delegate_matcher/stubbed_target.rb index 4a5c73a8..367c076c 100644 --- a/lib/shoulda/matchers/independent/delegate_matcher/stubbed_target.rb +++ b/lib/shoulda/matchers/independent/delegate_matcher/stubbed_target.rb @@ -17,7 +17,7 @@ module Shoulda args == received_arguments end - private + protected def stub_method(method) class_eval do