Sha256: 111459d1cb1074c88ed6004a97811b179edee1eb552a50da80c282534bc85087

Contents?: true

Size: 580 Bytes

Versions: 5

Compression:

Stored size: 580 Bytes

Contents

module Gemika
  class RSpec
    class << self

      def configure_transactional_examples
        ::RSpec.configure do |config|
          config.around do |example|
            if example.metadata.fetch(:transaction, example.metadata.fetch(:rollback, true))
              ActiveRecord::Base.transaction do
                begin
                  example.run
                ensure
                  raise ActiveRecord::Rollback
                end
              end
            else
              example.run
            end
          end
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gemika-0.1.4 lib/gemika/rspec.rb
gemika-0.1.3 lib/gemika/rspec.rb
gemika-0.1.2 lib/gemika/rspec.rb
gemika-0.1.1 lib/gemika/rspec.rb
gemika-0.1.0 lib/gemika/rspec.rb