-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up RSpec for testing with GOV.UK conventions
- Add `rspec-rails` and `govuk_test` gems - Set up RSpec configuration with sensible initial defaults and GOV.UK conventions from Developer Docs
- Loading branch information
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ENV["RAILS_ENV"] ||= "test" | ||
|
||
require "simplecov" | ||
SimpleCov.start "rails" | ||
|
||
require File.expand_path("../../config/environment", __FILE__) | ||
require "rspec/rails" | ||
|
||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } | ||
GovukTest.configure | ||
|
||
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | ||
RSpec.configure do |config| | ||
config.default_formatter = "doc" if config.files_to_run.one? | ||
config.disable_monkey_patching! | ||
config.example_status_persistence_file_path = "spec/examples.txt" | ||
config.expose_dsl_globally = false | ||
config.infer_spec_type_from_file_location! | ||
config.profile_examples = 10 | ||
config.shared_context_metadata_behavior = :apply_to_host_groups # Preempting v4 default | ||
|
||
config.order = :random | ||
Kernel.srand config.seed | ||
|
||
config.expect_with :rspec do |expectations| | ||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true # Preempting v4 default | ||
end | ||
|
||
config.mock_with :rspec do |mocks| | ||
mocks.verify_partial_doubles = true # Preempting v4 default | ||
end | ||
end |