リストに必要な要素が過不足なく含まれていることをチェックするとき,いちいちリストをソートしなくても=~を使えばよい # 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]