0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

「TestTube」にようこそ

Last updated at Posted at 2021-06-20

TestTubeを紹介したい 🧪

この簡単なテストツールはSpectusのエンジンです。

実験コード

使用するには、マッチャーが必要です。
例えば、Matchiにマッチャーのコレクションがあります。
以下のようなマッチャーを使います:

class BeTheAnswer
  def match?
    42.equal?(yield)
  end
end

そして、このブロックを定義します:

block_of_code = -> { "101010".to_i(2) }

では、結果を見てみましょう:

require "test_tube"
experiment = TestTube.invoke(
  matcher: BeTheAnswer.new,
  negate:  false,
  &block_of_code
)
experiment.actual # => 42
experiment.error  # => nil
experiment.got    # => true

成功!素晴らしいですね!
ご覧いただき、ありがとうございます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?