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.
3 4 5 6 7 8 |
# File 'lib/active_mocker/parent_class.rb', line 3 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.
10 11 12 |
# File 'lib/active_mocker/parent_class.rb', line 10 def error @error end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/active_mocker/parent_class.rb', line 12 def call if has_parent_class? deal_with_parent else create_error("#{class_name} is missing a parent class.") end self end |
#parent_mock_name ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/active_mocker/parent_class.rb', line 21 def parent_mock_name if @parent_mock_name "#{@parent_mock_name}#{mock_append_name}" else 'ActiveMocker::Base' end end |