spec/rails_helper.rb in exposition-0.0.5.5.pre.alpha vs spec/rails_helper.rb in exposition-0.0.5.6.pre.alpha
- old
+ new
@@ -2,24 +2,49 @@
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path('../dummy/config/environment', __FILE__)
require 'rspec/rails'
require 'rails-controller-testing'
-require 'factory_girl_rails'
+require 'factory_bot_rails'
require 'database_cleaner'
require 'shoulda-matchers'
require 'faker'
+require 'selenium/webdriver'
+require 'webdrivers/chromedriver'
ActiveRecord::Migration.maintain_test_schema!
# Adding support files
-# Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
Dir[Exposition::Engine.root.join("spec/support/**/*.rb")].each { |f| require f }
+Capybara.register_driver :chrome do |app|
+ Capybara::Selenium::Driver.new(app, browser: :chrome)
+end
+
+Capybara.register_driver :headless_chrome do |app|
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
+ chromeOptions: { args: %w(headless disable-gpu) }
+ )
+
+ Capybara::Selenium::Driver.new app,
+ browser: :chrome,
+ desired_capabilities: capabilities
+end
+
+Capybara.javascript_driver = :headless_chrome
+Capybara.server = :webrick
+
+Shoulda::Matchers.configure do |config|
+ config.integrate do |with|
+ with.test_framework :rspec
+ with.library :rails
+ end
+end
+
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
- config.include FactoryGirl::Syntax::Methods
+ config.include FactoryBot::Syntax::Methods
config.use_transactional_fixtures = false
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
@@ -39,13 +64,9 @@
config.after(:each) do
DatabaseCleaner.clean
end
- # Delete test files from paperclip
- config.after(:suite) do
- FileUtils.rm_rf(Dir["#{Rails.root}/spec/test_files/"])
- end
[:controller, :view, :request].each do |type|
config.include ::Rails::Controller::Testing::TestProcess, :type => type
config.include ::Rails::Controller::Testing::TemplateAssertions, :type => type
config.include ::Rails::Controller::Testing::Integration, :type => type
end