Sha256: 14baa0aa6e4aa2904fbe0da7d8cc72ff32e9709de3e7421e0f2acad2b8171e56

Contents?: true

Size: 1.94 KB

Versions: 9

Compression:

Stored size: 1.94 KB

Contents

ENV['RAILS_ENV'] ||= 'test'
require 'rspec'
require 'pry'
require 'timecop'
require 'webmock/rspec'

puts "Runnings specs in #{RUBY_VERSION} on #{RUBY_PLATFORM}"

begin
  require 'rails'
  Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support/rails','*.rb'))].each {|f| require f}
  puts 'Rails present, running Rails specific specs'
  RAILS_PRESENT = true
rescue LoadError
  puts 'Rails not present, skipping Rails specific specs'
  RAILS_PRESENT = false
end

def rails_present?
  RAILS_PRESENT
end

def active_record_present?
  require 'active_record'
  true
rescue LoadError
  false
end

def running_jruby?
  defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
end

def capistrano_present?
  !! Gem.loaded_specs['capistrano']
end

def capistrano2_present?
  capistrano_present? &&
    Gem.loaded_specs['capistrano'].version < Gem::Version.new('3.0')
end

def capistrano3_present?
  capistrano_present? &&
    Gem.loaded_specs['capistrano'].version >= Gem::Version.new('3.0')
end

def sequel_present?
  require 'sequel'
  true
rescue LoadError
  false
end

def padrino_present?
  require 'padrino'
  true
rescue LoadError
  false
end

require 'appsignal'

Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support/helpers','*.rb'))].each {|f| require f}

def tmp_dir
  @tmp_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'tmp'))
end

def fixtures_dir
  @fixtures_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'support/fixtures'))
end

RSpec.configure do |config|
  config.include ConfigHelpers
  config.include NotificationHelpers
  config.include TransactionHelpers

  config.before do
    ENV['PWD'] = File.expand_path(File.join(File.dirname(__FILE__), '../'))
    ENV['RAILS_ENV'] = 'test'
    ENV.delete('APPSIGNAL_PUSH_API_KEY')
    ENV.delete('APPSIGNAL_API_KEY')
  end

  config.after do
    FileUtils.rm_f(File.join(project_fixture_path, 'log/appsignal.log'))
    Appsignal.logger = nil
  end
end

class VerySpecificError < RuntimeError
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
appsignal-0.11.17 spec/spec_helper.rb
appsignal-0.11.16 spec/spec_helper.rb
appsignal-0.11.15 spec/spec_helper.rb
appsignal-0.11.14 spec/spec_helper.rb
appsignal-0.11.14.beta.1 spec/spec_helper.rb
appsignal-0.11.13 spec/spec_helper.rb
appsignal-0.11.13.beta.4 spec/spec_helper.rb
appsignal-0.11.13.beta.3 spec/spec_helper.rb
appsignal-0.11.13.beta.2 spec/spec_helper.rb