Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
--entrypoint redis-server
env:
BUNDLE_WITHOUT: development:production:console:unicorn
COVERAGE: true
RAILS_ENV: test
RSPEC_RENDER_VIEWS: true
permissions:
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Fixed `(hidden)` assignment labeling for assignments with `visible_on` and/or `visible_until` set (#7944)

### 🔧 Internal changes
- Added variable to enable simplecov in `spec_helper.rb` if and only if COVERAGE=true (#7960)
- Fixed flaky test `can bulk assign duplicated TAs to grade entry students` in `/spec/models/grade_entry_student_spec.rb` (#7958)
- Added tests for `GroupsController` to fully cover `global_actions` (#7955)
- Added tests for `graders_controller` to fully cover `grader_criteria_mapping` function (#7949)
Expand Down
39 changes: 23 additions & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'simplecov'
require 'simplecov-lcov'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.output_directory = 'coverage'
c.lcov_file_name = 'lcov.info'
end
# Enable simplecov only when COVERAGE environment variable is set to true
enable_coverage = ENV.fetch('COVERAGE', nil) == 'true'
if enable_coverage
require 'simplecov'
require 'simplecov-lcov'

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.output_directory = 'coverage'
c.lcov_file_name = 'lcov.info'
end

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter
])
SimpleCov.start do
add_filter 'better_errors'
add_filter 'bullet'
add_filter 'rails_erd'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter
])
SimpleCov.start do
add_filter 'better_errors'
add_filter 'bullet'
add_filter 'rails_erd'
end
end

ENV['RAILS_ENV'] ||= 'test'
Expand Down Expand Up @@ -98,7 +103,9 @@
# Override the default driver used by rspec system tests
driven_by :selenium_remote_chrome

SimpleCov.command_name 'system'
if enable_coverage
SimpleCov.command_name 'system'
end
end

config.before :each, type: :request do
Expand Down
Loading