Continue after exception in RSpec

Is there a way for RSpec to continue to process specifications after an exception occurs?

Here is what my specification task looks like:

SPEC_PATTERN = "spec/**/*_spec.rb" Spec::Rake::SpecTask.new() do |t| t.spec_files = FileList[SPEC_PATTERN] t.verbose = true t.spec_opts = ["--format", "html:spec/spec_report.html"] t.fail_on_error = false t.rcov = true t.rcov_dir = 'coverage' t.rcov_opts = ['--exclude', 'spec'] end 
+4
source share
3 answers
+2
source

rspec catches exceptions and reports them as failures, just like test / unit does. If you see a task exiting from it, because the exception is either outside the code processed by rspec, or it could be a syntax error.

NTN, David

+1
source
 it "should not raise an exception" do expect { raise Exception unless true }.should_not raise_exception end 
+1
source

Source: https://habr.com/ru/post/1302642/


All Articles