Examveda

Which method is commonly used to assert that a certain exception is raised in RSpec?

A. assert_raises(ExceptionClass) { ... }

B. expect { ... }.to throw_symbol(:exception_symbol)

C. expect { ... }.to raise_error(ExceptionClass)

D. assert_throw(:exception_symbol) { ... }

Answer: Option C


Join The Discussion

Related Questions on Testing in Ruby (RSpec, MiniTest, etc.)