Class: ActiveMocker::LoadedMocks::Features
- Inherits:
-
Object
- Object
- ActiveMocker::LoadedMocks::Features
- Includes:
- Singleton
- Defined in:
- lib/active_mocker/loaded_mocks/features.rb
Constant Summary collapse
- STUB_ACTIVE_RECORD_EXCEPTIONS =
{ "ActiveRecord::RecordNotFound" => ActiveMocker::RecordNotFound, "ActiveRecord::RecordNotUnique" => ActiveMocker::RecordNotUnique, "ActiveRecord::UnknownAttributeError" => ActiveMocker::UnknownAttributeError, }
- DEFAULTS =
{ timestamps: false, delete_all_before_example: false, stub_active_record_exceptions: STUB_ACTIVE_RECORD_EXCEPTIONS, }.freeze
Instance Method Summary collapse
- #[](feature) ⇒ Object
- #disable(feature) ⇒ Object
- #each(&block) ⇒ Object
- #enable(feature) ⇒ Object
-
#initialize ⇒ Features
constructor
A new instance of Features.
- #reset ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Features
Returns a new instance of Features.
20 21 22 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 20 def initialize reset end |
Instance Method Details
#[](feature) ⇒ Object
36 37 38 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 36 def [](feature) @features[feature] end |
#disable(feature) ⇒ Object
32 33 34 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 32 def disable(feature) update(feature, false) end |
#each(&block) ⇒ Object
24 25 26 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 24 def each(&block) @features.each(&block) end |
#enable(feature) ⇒ Object
28 29 30 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 28 def enable(feature) update(feature, true) end |
#reset ⇒ Object
40 41 42 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 40 def reset @features = DEFAULTS.dup end |
#to_h ⇒ Object
44 45 46 |
# File 'lib/active_mocker/loaded_mocks/features.rb', line 44 def to_h @features end |