ruby - How do you include a mixin when using Minitest specs? -
how should include mixin when using minitest specs?
this example of test suite in minitest specs:
require "minitest/autorun" describe meme before @meme = meme.new end describe "when asked cheeseburgers" "must respond positively" @meme.i_can_has_cheezburger?.must_equal "ohai!" end end end
the top-level describe
block defines test case in same way class definition if writing assert-style tests, you'll include mixin module would:
require "minitest/autorun" describe meme include mymixin before @meme = meme.new end describe "when asked cheeseburgers" "must respond positively" @meme.i_can_has_cheezburger?.must_equal "ohai!" end end end
remember: minitest ruby.
Comments
Post a Comment