Sha256: 39b1e048df5ebd28889fcd98f0313fe2f2f1515aa8e882508182ce6f0f06847c

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

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

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require 'rspec/rails'

# Capybara / Poltergeist
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist

Gem.loaded_specs['applicants'].dependencies.each do |d|
  require d.name if d.name != "poltergeist"
end

require 'sidekiq/testing'
Rails.backtrace_cleaner.remove_silencers!

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

RSpec.configure do |config|
  # Shim/Monkey-patch to make the engine routes available
  config.include EngineControllerTestMonkeyPatch, type: :controller

  config.infer_spec_type_from_file_location!
  config.expect_with(:rspec) { |c| c.syntax = %i{should expect} }
  config.mock_with(:rspec)   { |c| c.syntax = %i{should expect} }

  # https://github.com/rails/jbuilder/issues/32
  config.render_views = true
  config.include Capybara::DSL

  config.mock_with :rspec
  config.use_transactional_fixtures = false
  config.infer_base_class_for_anonymous_controllers = false
  config.order = "random"

  config.before do
    _presigner = double Aws::S3::Presigner
    allow(Aws::S3::Presigner).to receive(:new).and_return _presigner
    allow(_presigner).to receive(:presigned_url) do |_, opts|
      "#{opts[:bucket]}/#{opts[:key]}?expires_in=#{opts[:expires_in]}"
    end
  end
end

RSpec.shared_context "When authenticated by the admin section" do
  before do
    username = 'usertesting'
    password = 'usertesting'
    visit "http://#{username}:#{password}@#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}/applicants/spike"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
applicants-0.11.0 spec/spec_helper.rb