2015-08-10 11:05:06 +02:00
|
|
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
|
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
|
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
|
|
# this file to always be loaded, without a need to explicitly require it in any
|
|
|
|
# files.
|
|
|
|
#
|
|
|
|
# Given that it is always loaded, you are encouraged to keep this file as
|
|
|
|
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
|
|
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
|
|
# individual file that may not need all of that loaded. Instead, consider making
|
|
|
|
# a separate helper file that requires the additional dependencies and performs
|
|
|
|
# the additional setup, and require it from the spec files that actually need
|
|
|
|
# it.
|
|
|
|
#
|
|
|
|
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
|
|
# users commonly want.
|
|
|
|
#
|
|
|
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
|
|
|
2015-08-20 17:30:17 +02:00
|
|
|
ENV['RAILS_ENV'] ||= 'test'
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-08-20 17:30:17 +02:00
|
|
|
require File.expand_path('../../config/environment', __FILE__)
|
2015-08-10 11:05:06 +02:00
|
|
|
require 'rspec/rails'
|
|
|
|
require 'capybara/rspec'
|
|
|
|
require 'database_cleaner'
|
|
|
|
require 'webmock/rspec'
|
|
|
|
require 'shoulda-matchers'
|
|
|
|
require 'devise'
|
|
|
|
require 'factory_girl'
|
|
|
|
|
|
|
|
require 'capybara/poltergeist'
|
|
|
|
Capybara.javascript_driver = :poltergeist
|
|
|
|
Capybara.register_driver :poltergeist do |app|
|
2015-08-20 17:30:17 +02:00
|
|
|
Capybara::Poltergeist::Driver.new(app, js_errors: true, port: 44_678 + ENV['TEST_ENV_NUMBER'].to_i, phantomjs_options: ['--proxy-type=none'], timeout: 180)
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
Capybara.default_wait_time = 1
|
|
|
|
|
|
|
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
|
|
# in spec/support/ and its subdirectories.
|
2015-08-20 17:30:17 +02:00
|
|
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
|
|
|
Dir[Rails.root.join('spec/factories/**/*.rb')].each { |f| require f }
|
2015-08-10 11:05:06 +02:00
|
|
|
|
|
|
|
# Checks for pending migrations before tests are run.
|
|
|
|
# If you are not using ActiveRecord, you can remove this line.
|
|
|
|
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
|
|
|
|
2015-09-21 17:59:03 +02:00
|
|
|
DatabaseCleaner.strategy = :truncation
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-08-20 17:30:17 +02:00
|
|
|
SIADETOKEN = :valid_token unless defined? SIADETOKEN
|
2015-08-11 16:18:40 +02:00
|
|
|
|
2015-08-10 11:05:06 +02:00
|
|
|
include Warden::Test::Helpers
|
|
|
|
|
2016-01-11 14:10:41 +01:00
|
|
|
include SmartListing::Helper
|
|
|
|
include SmartListing::Helper::ControllerExtensions
|
|
|
|
|
|
|
|
module SmartListing
|
|
|
|
module Helper
|
|
|
|
def view_context
|
|
|
|
'mock'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-24 11:42:06 +02:00
|
|
|
WebMock.disable_net_connect!(allow_localhost: true)
|
|
|
|
|
2015-08-10 11:05:06 +02:00
|
|
|
RSpec.configure do |config|
|
|
|
|
config.filter_run_excluding disable: true
|
|
|
|
config.color = true
|
|
|
|
config.infer_spec_type_from_file_location!
|
|
|
|
config.tty = true
|
|
|
|
|
|
|
|
config.use_transactional_fixtures = false
|
|
|
|
|
|
|
|
config.infer_base_class_for_anonymous_controllers = false
|
|
|
|
|
2015-08-20 17:30:17 +02:00
|
|
|
config.order = 'random'
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-24 10:17:59 +02:00
|
|
|
config.include Devise::TestHelpers, type: :view
|
2015-08-20 17:30:17 +02:00
|
|
|
config.include Devise::TestHelpers, type: :controller
|
2015-08-10 11:05:06 +02:00
|
|
|
|
|
|
|
config.include FactoryGirl::Syntax::Methods
|
|
|
|
end
|