Sha256: 82750274c43febdb2ee98e00aeb47162f70d6dfad37cd8c8e20da9ced9fea7c9

Contents?: true

Size: 1.85 KB

Versions: 13

Compression:

Stored size: 1.85 KB

Contents

require 'simplecov'
require 'simplecov-rcov'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start do
  minimum_coverage 80
  add_filter "/spec/"
  add_filter "/config/"
end

ENV['RAILS_ENV'] ||= 'test'

require File.expand_path("../test_app/config/environment",  __FILE__)
require File.expand_path("../../lib/notifiable",  __FILE__)
require 'database_cleaner'
require 'rspec/rails'
require 'factory_girl_rails'

Rails.backtrace_cleaner.remove_silencers!

Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

DatabaseCleaner.strategy = :truncation

ActiveRecord::Migrator.migrate(File.join(Rails.root, 'db/migrate'))

RSpec.configure do |config|  
  config.mock_with :rspec
  config.use_transactional_fixtures = true
  config.infer_base_class_for_anonymous_controllers = false
  config.order = "random"
  
  # Remove need for factory girl prefix
  config.include FactoryGirl::Syntax::Methods
  
  # errors for deprecations
  #config.raise_errors_for_deprecations!
  
  # Infer the spec type from the containing folder
  config.infer_spec_type_from_file_location!
  
  config.before(:suite) do
    Notifiable.notifier_classes[:mock] = MockNotifier
    Notifiable.notifier_classes[:configurable_mock] = ConfigurableMockNotifier
    Notifiable::App.define_configuration_accessors(Notifiable.notifier_classes)
    #FactoryGirl.lint
  end
  
  config.before(:each) {
    DatabaseCleaner.start
    Notifiable.delivery_method = :send
    Notifiable.save_receipts = true 
    Notifiable.notification_status_batch_size = 10000
  }
  
  config.after(:each) {
    DatabaseCleaner.clean
  }
end

class MockNotifier < Notifiable::NotifierBase
  def enqueue(device_token, notification)
    processed(device_token, 0)
  end
end

class ConfigurableMockNotifier < Notifiable::NotifierBase
  notifier_attribute :use_sandbox
  
  def use_sandbox
    @use_sandbox
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
notifiable-rails-0.30.4 spec/spec_helper.rb
notifiable-rails-0.30.3 spec/spec_helper.rb
notifiable-rails-0.30.2 spec/spec_helper.rb
notifiable-rails-0.30.1 spec/spec_helper.rb
notifiable-rails-0.30.0 spec/spec_helper.rb
notifiable-rails-0.29.0 spec/spec_helper.rb
notifiable-rails-0.28.1 spec/spec_helper.rb
notifiable-rails-0.28.0 spec/spec_helper.rb
notifiable-rails-0.27.1 spec/spec_helper.rb
notifiable-rails-0.27.0 spec/spec_helper.rb
notifiable-rails-0.26.3 spec/spec_helper.rb
notifiable-rails-0.26.1 spec/spec_helper.rb
notifiable-rails-0.26.0 spec/spec_helper.rb