Sha256: 237c8c35e807e464da26c2e74dc77df0f0e1cbeeaa4ec399c537f0e6cb48ee28

Contents?: true

Size: 905 Bytes

Versions: 10

Compression:

Stored size: 905 Bytes

Contents

require "rspec"
require "active_record"
require "timecop"
require "tmpdir"
require "support/db_connection"
require "support/stub_rails"
require "support/wait_for_pop"
require "active_record/sql_analyzer.rb"

DBConnection.setup_db
ActiveRecord::SqlAnalyzer.install!

RSpec.configure do |c|
  c.disable_monkey_patching!

  c.before :each do
    DBConnection.reset
  end

  c.after :each do
    # Try and reset our state to something a bit fresher
    if ActiveRecord::SqlAnalyzer.config
      thread = ActiveRecord::SqlAnalyzer.background_processor.instance_variable_get(:@thread)
      thread.terminate if thread

      ActiveRecord::SqlAnalyzer.config[:analyzers].each do |analyzer|
        analyzer[:logger_instance].close
      end

      ActiveRecord::SqlAnalyzer.instance_variable_set(:@background_processor, nil)
      ActiveRecord::SqlAnalyzer.instance_variable_set(:@config, nil)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_record-sql_analyzer-0.3.0 spec/spec_helper.rb
active_record-sql_analyzer-0.2.3 spec/spec_helper.rb
active_record-sql_analyzer-0.2.2 spec/spec_helper.rb
active_record-sql_analyzer-0.2.1 spec/spec_helper.rb
active_record-sql_analyzer-0.2.0 spec/spec_helper.rb
active_record-sql_analyzer-0.1.0 spec/spec_helper.rb
active_record-sql_analyzer-0.0.8 spec/spec_helper.rb
active_record-sql_analyzer-0.0.7 spec/spec_helper.rb
active_record-sql_analyzer-0.0.6 spec/spec_helper.rb
active_record-sql_analyzer-0.0.5 spec/spec_helper.rb