Move History

Fork Selected
  • Code
    def verify_sum(a,b)
      return false if a.nil? || b.nil?
    
      a.sum == b.sum
    end
    Test Cases
    # 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
    
    
  • Code
    • def verify_sum(a,b)a.sum==b.sum rescue !1end
    • def verify_sum(a,b)a&&b&&a.sum==b.sum||!1end
    • def verify_sum(a,b)
    • return false if a.nil? || b.nil?
    • a.sum == b.sum
    • end