Skip to content

Codewars Ruby Test Framework

kazk edited this page Sep 7, 2017 · 1 revision

Basic Setup

describe "Tests" do
  it "a test case" do
    Test.assert_equals(add(1, 1), 2, "optional message")
  end
end

Assertions

TODO Improve the descriptions while keeping them simple.

Test.assert_equals(actual, expected, msg = nil)

Checks that the actual value equals the expected value.

Test.assert_not_equals(actual, unexpected, msg = nil)

Checks that the actual value does not equal the unexpected value.

Test.expect_error(msg, &block)

Checks that block raises an error.

Test.expect_no_error(msg, &block)

Checks that block raises no error.

Test.expect(passed, msg = nil)

Checks that passed is truthy.

Utilities

Test.random_number()

Returns a random number.

Test.random_token()

Returns a random string.

Clone this wiki locally
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy