templates/spec_helper.rb in welaika-suspenders-2.26.0 vs templates/spec_helper.rb in welaika-suspenders-2.27.0
- old
+ new
@@ -1,14 +1,19 @@
-require "simplecov"
-require "simplecov-json"
-SimpleCov.start "rails" do
- add_group "Services", "app/services"
+require 'simplecov'
+SimpleCov.start 'rails' do
+ add_group 'Services', 'app/services'
end
-SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
-require "webmock/rspec"
+# Save to CircleCI's artifacts directory if we're on CircleCI
+if ENV['CIRCLE_ARTIFACTS']
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
+ SimpleCov.coverage_dir(dir)
+end
+require 'webmock/rspec'
+require 'timecop'
+
# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
end
@@ -16,12 +21,15 @@
config.mock_with :rspec do |mocks|
mocks.syntax = :expect
mocks.verify_partial_doubles = true
end
- config.example_status_persistence_file_path = "tmp/rspec_examples.txt"
+ config.example_status_persistence_file_path = 'tmp/rspec_examples.txt'
config.order = :random
config.default_formatter = 'doc' if config.files_to_run.one?
end
WebMock.disable_net_connect!(allow_localhost: true)
+
+# Only allow Timecop with block syntax
+Timecop.safe_mode = true