LoginSignup
3
3

More than 5 years have passed since last update.

あるコレクションの要素がすべてあるクラスを継承 or モジュールをmix-inしているかを検証するmatcher

Posted at
RSpec::Matcher.define :be_composed_of do |expected|
  match do |actual|
    actual.all? {|e| expected === e }
  end
end

failure_messages とかいじってないけどとりあえず。

should(be_all {|i| String === i }) とか書いてたけどいい加減ダサいしつらくなってきたのでmatcherを追加。

3
3
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
3
3