Sha256: b7b05c28337811b0e0476d915ef34b2489fd5ecae4ab939c9505a0f49f61c54b

Contents?: true

Size: 677 Bytes

Versions: 21

Compression:

Stored size: 677 Bytes

Contents

require 'spec_helper'
require 'rails'

def unit_example?(metadata)
  metadata[:file_path] =~ %r{spec/unit}
end

RSpec.configure do |config|
  config.before(:each) do
    Modis.with_connection do |redis|
      redis.keys('rpush:*').each { |key| redis.del(key) }
    end if redis?

    if active_record? && unit_example?(self.class.metadata)
      connection = ActiveRecord::Base.connection
      connection.begin_transaction joinable: false
    end
  end

  config.after(:each) do
    if active_record? && unit_example?(self.class.metadata)
      connection = ActiveRecord::Base.connection
      connection.rollback_transaction if connection.transaction_open?
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
rpush-5.0.0 spec/unit_spec_helper.rb
rpush-4.2.0 spec/unit_spec_helper.rb
rpush-4.1.1 spec/unit_spec_helper.rb
rpush-4.1.0 spec/unit_spec_helper.rb
rpush-4.0.1 spec/unit_spec_helper.rb
rpush-4.0.0 spec/unit_spec_helper.rb
rpush-3.3.1 spec/unit_spec_helper.rb
rpush-3.3.0 spec/unit_spec_helper.rb
rpush_extended-3.2.6 spec/unit_spec_helper.rb
rpush_extended-3.2.5 spec/unit_spec_helper.rb
rpush-3.2.4 spec/unit_spec_helper.rb
rpush-3.2.3 spec/unit_spec_helper.rb
rpush-3.2.2 spec/unit_spec_helper.rb
rpush-3.2.1 spec/unit_spec_helper.rb
rpush-3.2.0 spec/unit_spec_helper.rb
rpush-3.1.1 spec/unit_spec_helper.rb
rpush-3.1.0 spec/unit_spec_helper.rb
rpush-3.0.2 spec/unit_spec_helper.rb
rpush-3.0.1 spec/unit_spec_helper.rb
rpush-3.0.0 spec/unit_spec_helper.rb