タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

rspecに関するan-ironic-manのブックマーク (1)

  • Rspecでリストのチェック - Qiita

    リストに必要な要素が過不足なく含まれていることをチェックするとき,いちいちリストをソートしなくても=~を使えばよい # test [:zero, :one, :three].should =~ [:one, :two] # log Failure/Error: [:zero, :one, :three].should =~ [:one, :two] expected collection contained: [:one, :two] actual collection contained: [:one, :three, :zero] the missing elements were: [:two] the extra elements were: [:three, :zero] Register as a new user and use Qiita more conveniently

    Rspecでリストのチェック - Qiita
    an-ironic-man
    an-ironic-man 2012/07/03
    array1.should =~ array2で配列どうしの要素が同じかどうか判別。要素の順番は気にしない。マッチしない場合、要素の過不足を表示してくれる。
  • 1