2015-03-09 04:49:42 -06:00
|
|
|
require 'codeclimate-test-reporter'
|
2015-03-09 04:18:02 -06:00
|
|
|
CodeClimate::TestReporter.start
|
2014-04-28 22:06:40 -06:00
|
|
|
require 'simplecov'
|
|
|
|
#Ignore anything with the word 'spec' in it. No need to test your tests.
|
2014-06-20 19:54:45 -06:00
|
|
|
SimpleCov.start do
|
|
|
|
add_filter '/spec/'
|
|
|
|
add_filter 'config/initializers'
|
|
|
|
end
|
2014-04-28 22:06:40 -06:00
|
|
|
require 'pry'
|
|
|
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2015-03-09 04:49:42 -06:00
|
|
|
ENV['RAILS_ENV'] ||= 'test'
|
|
|
|
require File.expand_path('../../config/environment', __FILE__)
|
2014-04-28 22:06:40 -06:00
|
|
|
require 'rspec/rails'
|
2014-04-30 07:19:43 -06:00
|
|
|
require 'capybara/rails'
|
|
|
|
require 'capybara/rspec'
|
2014-05-08 08:02:51 -06:00
|
|
|
require 'features/helpers'
|
2015-11-24 11:51:09 -07:00
|
|
|
# require 'capybara/poltergeist'
|
|
|
|
# Capybara.javascript_driver = :poltergeist
|
2015-03-19 14:05:42 -06:00
|
|
|
Capybara.register_driver :poltergeist do |app|
|
2015-11-24 11:51:09 -07:00
|
|
|
# Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path)
|
2015-03-19 14:05:42 -06:00
|
|
|
Capybara::Poltergeist::Driver.new(app, timeout: 300)
|
|
|
|
Capybara::Poltergeist::Driver.new(app, js_errors: true)
|
|
|
|
end
|
2014-04-28 22:06:40 -06:00
|
|
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
|
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
|
|
# run as spec files by default. This means that files in spec/support that end
|
|
|
|
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
|
|
# run twice. It is recommended that you do not name files matching this glob to
|
|
|
|
# end with _spec.rb. You can configure this pattern with with the --pattern
|
|
|
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
2015-03-09 04:49:42 -06:00
|
|
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
2014-04-28 22:06:40 -06:00
|
|
|
|
2015-06-10 05:56:35 -06:00
|
|
|
SmarfDoc.config do |c|
|
|
|
|
c.template_file = 'api_docs.md.erb'
|
|
|
|
c.output_file = 'api_docs.md'
|
|
|
|
end
|
|
|
|
|
2014-04-28 22:06:40 -06:00
|
|
|
RSpec.configure do |config|
|
|
|
|
|
2016-08-31 12:16:03 -06:00
|
|
|
config.backtrace_exclusion_patterns = [/gems/]
|
|
|
|
|
2014-05-08 08:02:51 -06:00
|
|
|
config.include Helpers
|
2014-06-30 07:19:59 -06:00
|
|
|
config.infer_spec_type_from_file_location!
|
2015-03-09 04:49:42 -06:00
|
|
|
config.order = 'random'
|
2014-05-08 08:02:51 -06:00
|
|
|
|
2015-06-10 05:56:35 -06:00
|
|
|
if ENV['docs']
|
2016-09-20 12:26:05 -06:00
|
|
|
config.before(:each, type: :controller) do
|
2015-06-10 05:56:35 -06:00
|
|
|
SmarfDoc.run!(request, response)
|
2016-09-20 12:26:05 -06:00
|
|
|
ActiveRecord::Base.subclasses.(&:destroy_all)
|
2015-06-10 05:56:35 -06:00
|
|
|
end
|
|
|
|
end
|
2016-09-05 10:46:50 -06:00
|
|
|
|
2016-09-01 09:02:54 -06:00
|
|
|
config.after(:suite) do
|
|
|
|
SmarfDoc.finish!
|
2014-04-28 22:06:40 -06:00
|
|
|
end
|
2016-09-02 08:19:27 -06:00
|
|
|
end
|