Installazione Rspec
Dopo aver eseguito il passaggio precedente ed aver installato le gemme per la suite di test inizializzare rspec con il comando sottostante
rspec --initApri il file .rspec e sovrascrivi il contenuto con
--require rails_helper
--format documentation
--order random
--color
Apri il file spec/spec_helper.rb e sovrascrivi il contenuto con
require 'webmock/rspec'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
expectations.max_formatted_output_length = 1_000_000
end
config.mock_with :rspec do |mocks|
mocks.syntax = :expect
mocks.verify_partial_doubles = true
end
config.raise_errors_for_deprecations!
config.disable_monkey_patching!
config.default_formatter = 'doc' if config.files_to_run.one?
config.filter_run_when_matching(:focus)
config.silence_filter_announcements = true
config.fail_if_no_examples = true
config.warnings = false
config.raise_on_warning = true
config.threadsafe = true
config.shared_context_metadata_behavior = :apply_to_host_groups
config.order = :random
Kernel.srand(config.seed)
end
Apri il file spec/rails_helper.rb e sovrascrivi il contenuto con
Aggiungere, in config/initializers/generators.rb queste configurazioni per bloccare la generazione automatica dei test da parte di Rails.
Last updated
Was this helpful?