Sha256: 12b8c7dcf56319a3f74e176df5865f849b12f508fab30b2156f7ecbd5b662891

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH << File.expand_path('../support', __FILE__)

# Use Rails 4 by default if you just do 'rspec spec'
ENV['BUNDLE_GEMFILE'] ||= 'gemfiles/rails40.gemfile'

ENV['BUNDLE_GEMFILE'] = File.expand_path(ENV['BUNDLE_GEMFILE'])
require "bundler"
Bundler.setup

ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] = File.expand_path("../dummy/rails-#{ENV['RAILS_VERSION']}", __FILE__)

# Create the test app if it doesn't exists
unless File.exists?(ENV['RAILS_ROOT'])
  system 'rake setup'
end

require 'rails/all'
require 'sidekiq'
require File.expand_path("#{ENV['RAILS_ROOT']}/config/environment.rb",  __FILE__)

puts "Testing with Rails #{Rails::VERSION::STRING} and Ruby #{RUBY_VERSION}"

require 'rspec/rails'
require 'factory_girl_rails'
require 'sidekiq/testing'
Sidekiq::Testing.inline!

RSpec.configure do |config|
  config.infer_base_class_for_anonymous_controllers = false
  config.use_transactional_fixtures = true

  def mailer_should_render_template(mailer, template)
    original_method = mailer.method(:_render_template)
    mailer.should_receive(:_render_template) do |arg|
      arg[:template].virtual_path.should eq template
      original_method.call(arg)
    end
  end

  def json
    JSON.parse(response.body).with_indifferent_access
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notify_user-0.0.1 spec/spec_helper.rb