2014-03-23 00:22:25 +00:00
|
|
|
ENV["RAILS_ENV"] ||= 'test'
|
|
|
|
|
2014-03-25 21:58:51 +00:00
|
|
|
require 'codeclimate-test-reporter'
|
2014-03-23 00:22:25 +00:00
|
|
|
require 'simplecov'
|
2014-03-25 21:58:51 +00:00
|
|
|
CodeClimate::TestReporter.start
|
2014-03-23 00:22:25 +00:00
|
|
|
SimpleCov.start 'rails'
|
|
|
|
|
|
|
|
require File.expand_path("../../config/environment", __FILE__)
|
|
|
|
require 'rspec/rails'
|
|
|
|
require 'capybara/rspec'
|
|
|
|
require 'capybara/poltergeist'
|
|
|
|
|
2015-08-15 11:50:28 +00:00
|
|
|
Capybara.default_wait_time = 5
|
2014-03-30 19:50:52 +00:00
|
|
|
Capybara.register_driver :poltergeist do |app|
|
2014-04-06 14:23:17 +00:00
|
|
|
Capybara::Poltergeist::Driver.new(app,
|
2014-08-10 20:55:44 +00:00
|
|
|
timeout: 30,
|
2014-04-06 14:23:17 +00:00
|
|
|
phantomjs_logger: File.open('/dev/null')
|
|
|
|
)
|
2014-03-30 19:50:52 +00:00
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-10-12 10:46:58 +00:00
|
|
|
Capybara.javascript_driver = :poltergeist
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-03-30 19:50:52 +00:00
|
|
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include FactoryGirl::Syntax::Methods
|
2014-03-30 19:50:52 +00:00
|
|
|
config.include Controllers::JsonHelpers, type: :controller
|
|
|
|
config.include Features::FormHelpers, type: :feature
|
2015-05-14 16:27:12 +00:00
|
|
|
config.include Features::ServerHelpers, type: :feature
|
2014-03-30 19:50:52 +00:00
|
|
|
config.include Features::SessionHelpers, type: :feature
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
2014-03-30 19:50:52 +00:00
|
|
|
config.order = 'random'
|
|
|
|
config.use_transactional_fixtures = false
|
2015-05-02 22:46:16 +00:00
|
|
|
config.color = true
|
|
|
|
config.formatter = :documentation
|
2015-08-15 11:50:28 +00:00
|
|
|
config.infer_spec_type_from_file_location!
|
2015-04-25 22:15:10 +00:00
|
|
|
|
|
|
|
config.before(:each) do
|
|
|
|
events_list_json = JSON.parse(File.read(Rails.root.join('spec/fixtures/google_calendar.json')))
|
|
|
|
|
|
|
|
GoogleCalendar::Request.stub(:events_list) do
|
|
|
|
GoogleCalendar::EventList.new(events_list_json, Time.zone.name)
|
|
|
|
end
|
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|