2019-08-31から1日間の記事一覧

RSpec の have_attributes マッチャがリテラルとマッチャを両方指定できる仕組み

have_attributes マッチャ RSpec に have_attributes というマッチャがある。 it { expect(10.to_s).to eq("10") } it { expect(10.positive?).to eq(true) } と書くところを it { expect(10).to have_attributes(to_s: "10", positive?: true) } と書くこと…