What is the purpose of the before hook in RSpec?
A. Executes code after all examples
B. Executes code before all examples
C. Executes code after each example
D. Executes code before each example
Answer: Option D
Which testing framework is commonly used for behavior-driven development (BDD) in Ruby?
A. MiniTest
B. Test::Unit
C. RSpec
D. Cucumber
What is the purpose of a test suite in Ruby testing?
A. A single test case
B. A group of related test cases
C. A test runner
D. A single test case
Which assertion method is commonly used in RSpec for testing equality of values?
A. expect(actual).to equal(expected)
B. assert_equal(actual, expected)
C. expect(actual).to eq(expected)
D. assert_equal(expected, actual)
What is the purpose of a mock object in Ruby testing?
A. Asserts that a particular condition is true
B. Provides a placeholder for a method that will be defined later
C. Checks if an object's methods are called with the correct arguments
D. Simulates the behavior of a real object
Join The Discussion