Sha256: 1ff2f130e1309bc34e4acd9d94e43da64450cd7c7a03ab3b9e37bcbc46235dcd
Contents?: true
Size: 1.12 KB
Versions: 9
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module Cucumber module Rails module Database class Strategy def initialize(options = {}) @options = options end def before_js(strategy) @original_strategy = if defined?(DatabaseCleaner::VERSION) && Gem::Version.new(DatabaseCleaner::VERSION) >= Gem::Version.new('1.8.0.beta') raise "No DatabaseCleaner strategies found. Make sure you have required one of DatabaseCleaner's adapters" if DatabaseCleaner.cleaners.empty? DatabaseCleaner.cleaners.values.first.strategy # that feels like a nasty hack else DatabaseCleaner.connections.first.strategy # that feels like a nasty hack end DatabaseCleaner.strategy = strategy, @options end def before_non_js # no-op end def after return unless @original_strategy DatabaseCleaner.strategy = @original_strategy @original_strategy = nil end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems