Class: ActiveMocker::ParentClass
- Inherits:
-
Object
- Object
- ActiveMocker::ParentClass
- Defined in:
- lib/active_mocker/parent_class.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(parsed_source:, klasses_to_be_mocked:, mock_append_name:, active_record_base_klass: ::ActiveRecord::Base) ⇒ ParentClass
constructor
A new instance of ParentClass.
- #parent_mock_name ⇒ Object
Constructor Details
#initialize(parsed_source:, klasses_to_be_mocked:, mock_append_name:, active_record_base_klass: ::ActiveRecord::Base) ⇒ ParentClass
Returns a new instance of ParentClass.
4 5 6 7 8 9 |
# File 'lib/active_mocker/parent_class.rb', line 4 def initialize(parsed_source:, klasses_to_be_mocked:, mock_append_name:, active_record_base_klass: ::ActiveRecord::Base) @parsed_source = parsed_source @klasses_to_be_mocked = klasses_to_be_mocked @active_record_base_klass = active_record_base_klass @mock_append_name = mock_append_name end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
11 12 13 |
# File 'lib/active_mocker/parent_class.rb', line 11 def error @error end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/active_mocker/parent_class.rb', line 13 def call if parent_class? deal_with_parent else create_error("#{class_name} is missing a parent class.") end self end |
#parent_mock_name ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/active_mocker/parent_class.rb', line 22 def parent_mock_name if @parent_mock_name "#{@parent_mock_name}#{mock_append_name}" else "ActiveMocker::Base" end end |