Sha256: 46387460fe15a7d8af46ad498832a395ca6459dcaeecf1903c57726ce5a16ad9

Contents?: true

Size: 798 Bytes

Versions: 27

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

module PaperTrail
  module RSpec
    module Helpers
      # Included in the RSpec configuration in `frameworks/rspec.rb`
      module InstanceMethods
        # enable versioning for specific blocks (at instance-level)
        def with_versioning
          was_enabled = ::PaperTrail.enabled?
          ::PaperTrail.enabled = true
          yield
        ensure
          ::PaperTrail.enabled = was_enabled
        end
      end

      # Extended by the RSpec configuration in `frameworks/rspec.rb`
      module ClassMethods
        # enable versioning for specific blocks (at class-level)
        def with_versioning(&block)
          context "with versioning", versioning: true do
            class_exec(&block)
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
paper_trail-10.0.0 lib/paper_trail/frameworks/rspec/helpers.rb
paper_trail-9.2.0 lib/paper_trail/frameworks/rspec/helpers.rb
paper_trail-9.1.1 lib/paper_trail/frameworks/rspec/helpers.rb
paper_trail-9.1.0 lib/paper_trail/frameworks/rspec/helpers.rb
paper_trail-9.0.2 lib/paper_trail/frameworks/rspec/helpers.rb
paper_trail-9.0.1 lib/paper_trail/frameworks/rspec/helpers.rb
paper_trail-9.0.0 lib/paper_trail/frameworks/rspec/helpers.rb