Complete the code to assert that the value of x is true.
assert [1]The assert method checks if the given expression is true. Here, x should be true for the test to pass.
Complete the code to assert that two values are equal.
assert_equal([1], result)The assert_equal method checks if the first argument equals the second. Here, we expect result to be 5.
Fix the error in the assertion to check if the array includes the number 3.
assert [1].include?(3)
The assert method needs a condition. Here, we check if array.include?(3) is true.
Fill both blanks to assert that the string 'hello' starts with 'he'.
assert [1].start_with?([2])
The assert checks if greeting.start_with?('he') is true.
Fill all three blanks to assert that the hash has a key :name and its value is 'Alice'.
assert [1].key?([2]) && [3][:name] == 'Alice'
This assertion checks two things: the hash person has the key :name, and the value for that key is 'Alice'.