Sha256: b957fe94682a00fe2c7921ec50b10bbcd2da5fed129e359e08d8587f2fd1eb55

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)

ENV['RAILS_ENV'] ||= 'test'
ENV['APP_NAME'] = 'Test app'
ENV['COUNTRY_CODE'] = 'GB'
ENV['TWILIO_ACCOUNT_SID'] = 'account_sid'
ENV['TWILIO_AUTH_TOKEN'] = 'auth_token'

require 'active_record'
require 'factory_bot'
require 'rails'
require 'twilio_base'

require File.expand_path('twilio_base_dummy/config/environment.rb', __dir__)
Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |file| require file }

require 'bundler/setup'
require 'byebug'
require 'faker'
require 'database_cleaner'
require 'shoulda/matchers'
require 'shoulda/callback/matchers'
require 'timecop'
require 'rspec/rails'

ActiveRecord::Migration.maintain_test_schema!

Shoulda::Matchers.configure do |config|
  config.integrate do |with|
    with.test_framework :rspec
    with.library :active_record
  end
end

TwilioBase::Engine.routes.default_url_options[:host] = 'localhost:3000'

RSpec.configure do |config|
  config.include(Shoulda::Matchers::ActiveModel, type: :model)
  config.include(Shoulda::Matchers::ActiveRecord, type: :model)
  config.include(Shoulda::Callback::Matchers::ActiveModel)
  config.include(TwilioBase::Responses::Twiml)
  config.example_status_persistence_file_path = '.rspec_status'
  config.disable_monkey_patching!
  config.infer_spec_type_from_file_location!

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.before(:each) do
    TwilioBase::Fake::Helpers.clean_cache
    Rails.cache.clear
  end

  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation, except: %w[ar_internal_metadata])
  end

  config.around(:each) do |example|
    DatabaseCleaner.cleaning do
      example.run
    end
  end

  Twilio::REST::Client = TwilioBase::Fake::Clients::Rest
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twilio_base-1.11.1101 spec/spec_helper.rb
twilio_base-1.11.11 spec/spec_helper.rb