Examveda

Which assertion method is commonly used in RSpec for testing if an object responds to a method?

A. expect(object).to respond_to(:method)

B. assert_respond_to(object, :method)

C. assert(object.respond_to?(:method))

D. expect(object).to have_method(:method)

Answer: Option A


Join The Discussion

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