def verify_sum(w1, w2) w1.sum == w2.sum rescue false end
def verifySum(w1, w2)!!(w1 && w2 && w1.downcase.chars.sum(&:ord) == w2.downcase.chars.sum(&:ord))- def verify_sum(w1, w2)
- w1.sum == w2.sum rescue false
- end
# From Ruby 3.0, RSpec is used under the hood. # See https://rspec.info/ # Defaults to the global `describe` for backwards compatibility, but `RSpec.desribe` works as well. describe "Example" do it "should return the sum" do expect(verify_sum("Sebastian", "Patricia")).to eq(false) expect(verify_sum("Anna", "Nana")).to eq(true) expect(verify_sum("John", nil)).to eq(false) # The following is still supported, but new tests should now use them. # Test.assert_equals(add(1, 1), 2) end end
Test.assert_equals(verifySum('Sebastian', 'Patricia'), false);Test.assert_equals(verifySum('Anna', 'Nana'), true);Test.assert_equals(verifySum('John', nil), false);- # From Ruby 3.0, RSpec is used under the hood.
- # See https://rspec.info/
- # Defaults to the global `describe` for backwards compatibility, but `RSpec.desribe` works as well.
- describe "Example" do
- it "should return the sum" do
- expect(verify_sum("Sebastian", "Patricia")).to eq(false)
- expect(verify_sum("Anna", "Nana")).to eq(true)
- expect(verify_sum("John", nil)).to eq(false)
- # The following is still supported, but new tests should now use them.
- # Test.assert_equals(add(1, 1), 2)
- end
- end