Module: ModelTimeline::RSpec
- Defined in:
- lib/model_timeline/rspec.rb,
lib/model_timeline/rspec/matchers.rb
Overview
Helper module that configures RSpec to work with ModelTimeline
This module provides RSpec configuration for ModelTimeline, including:
-
Disabling timeline recording by default for faster tests
-
Enabling timeline recording only when specifically requested
-
Including custom RSpec matchers for testing timeline entries
Defined Under Namespace
Modules: Matchers
Class Method Summary collapse
-
.included(config) ⇒ void
Configures RSpec with ModelTimeline hooks when included.
Class Method Details
.included(config) ⇒ void
This method returns an undefined value.
Configures RSpec with ModelTimeline hooks when included
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/model_timeline/rspec.rb', line 31 def self.included(config) # Reset timeline state before each example config.before(:each) do |example| ModelTimeline.disable! unless example.[:with_timeline] end # Enable timeline when the :with_timeline metadata is present config.around(:each, :with_timeline) do |example| ModelTimeline.enable! example.run ensure ModelTimeline.disable! end # Include custom RSpec matchers for testing timeline entries config.include ModelTimeline::RSpec::Matchers end |