spec/spec_helper.rb in notifiable-apns-grocer-0.17.1 vs spec/spec_helper.rb in notifiable-apns-grocer-0.18.0

- old
+ new

@@ -1,50 +1,33 @@ -ENV['RAILS_ENV'] ||= 'test' - require 'simplecov' require 'simplecov-rcov' SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter SimpleCov.start do add_filter "/spec/" end require 'timeout' require 'database_cleaner' require 'active_record' -require 'rails' require 'notifiable' +require 'notifiable/apns/grocer' require 'grocer' -require File.expand_path("../../lib/notifiable/apns/grocer", __FILE__) +require 'byebug' + Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } -db_path = 'spec/test.sqlite3' -DatabaseCleaner.strategy = :truncation +# Setup ActiveRecord db connection +ActiveRecord::Base.establish_connection(YAML.load_file('config/database.yml')['test']) -Rails.logger = Logger.new(STDOUT) - -require 'byebug' - RSpec.configure do |config| config.mock_with :rspec config.order = "random" config.before(:all) { + DatabaseCleaner.strategy = :truncation Notifiable.notifier_classes[:apns] = Notifiable::Apns::Grocer::Stream Notifiable::App.define_configuration_accessors(Notifiable.notifier_classes) - - # DB setup - ActiveRecord::Base.establish_connection( - { :adapter => 'sqlite3', - :database => db_path, - :pool => 5, - :timeout => 5000} - ) - - ActiveRecord::Migration.verbose = false - notifiable_rails_path = Gem.loaded_specs['notifiable-rails'].full_gem_path - - ActiveRecord::MigrationContext.new(File.join(notifiable_rails_path, 'db', 'migrate')).migrate @grocer = Grocer.server(port: 2195) @grocer.accept } @@ -57,10 +40,7 @@ DatabaseCleaner.clean } config.after(:all) { @grocer.close - - # drop the database - File.delete(db_path) } end