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?

More than 3 years have passed since last update.

「TestTube」にようこそ

Last updated at Posted at 2021-06-20

**TestTube**を紹介したい 🧪

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

実験コード

使うために、マッチャーがいる。
例えば、Matchiから、コレクションがある。

今のは、このマッチャーを使う:

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

それに、このブロックを定義する:

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

今、結果を見てみよう:

require "test_tube"

experiment = TestTube.invoke(
  isolate: false,
  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?