Farmbot-Web-App/spec/spec_helper.rb

57 lines
1.9 KiB
Ruby
Raw Normal View History

require 'codeclimate-test-reporter'
2015-03-09 04:18:02 -06:00
CodeClimate::TestReporter.start
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
require 'pry'
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
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
Capybara.register_driver :poltergeist do |app|
2015-11-24 11:51:09 -07:00
# Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path)
Capybara::Poltergeist::Driver.new(app, timeout: 300)
Capybara::Poltergeist::Driver.new(app, js_errors: true)
end
# 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`.
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
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
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!
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
config.after(:suite) do
SmarfDoc.finish!
end
end