Sha256: c26fdd110561c2ff92d54bc82acb366d79b699404aaa82a034b9210a4b31637f
Contents?: true
Size: 672 Bytes
Versions: 6
Compression:
Stored size: 672 Bytes
Contents
RSpec.shared_examples_for "dimorphic" do |attrs| let(:model) { described_class } describe "works ok!" do let(:sex) { Commons::Concerns::Attributes::Sex::FEMALE } let(:obj) { FactoryBot.build(model.to_s.underscore.to_sym) } subject do obj.sex = sex obj end it "when value dimorphic" do expect(subject.sex).to eq sex expect(subject.female_sex?).to be true end end describe "fails!" do let(:obj) { FactoryBot.build(model.to_s.underscore.to_sym) } subject do obj.sex = 'random string' end it "when value not dimorphic" do expect{ subject }.to raise_error(ArgumentError) end end end
Version data entries
6 entries across 6 versions & 1 rubygems