Skip to content

Commit

Permalink
Fixed Simplecov issue.
Browse files Browse the repository at this point in the history
Moved Simplecov initialization from spec_helper to rails_helper so it's the first thing that runs and picks up all files.
  • Loading branch information
blimey85 committed Jun 21, 2018
1 parent 39aade5 commit 32a09c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 15 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# frozen_string_literal: true

# Simplecov MUST be called before anything else
unless ENV['nocoverage']
require 'simplecov'
require 'simplecov-console'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console
]
)
SimpleCov.start 'rails' do
add_filter '/controllers/'
end
end

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
Expand Down
14 changes: 0 additions & 14 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
# frozen_string_literal: true

unless ENV['nocoverage']
require 'simplecov'
require 'simplecov-console'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console
]
)
SimpleCov.start 'rails' do
add_filter '/controllers/'
end
end

RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.syntax = [:expect, :should]
Expand Down

0 comments on commit 32a09c3

Please sign in to comment.