Sha256: db7242eb40b214ee0cf4e9227e1d5a875ce990dffdb3e0e4581004332f4b7c15
Contents?: true
Size: 962 Bytes
Versions: 19
Compression:
Stored size: 962 Bytes
Contents
describe Mattock::Configurable do class TestSuperStruct include Mattock::Configurable setting(:three, 3) required_field(:four) end class TestStruct < TestSuperStruct settings(:one => 1, :two => nested(:a => "a").required_field(:b)) nil_field(:five) end subject do TestStruct.new.setup_defaults end it "should set defaults" do subject.one.should == 1 subject.two.a.should == "a" subject.three.should == 3 subject.five.should be_nil end it "should complain about unset required fields" do expect do subject.check_required end.to raise_error end it "should complain about unset nested required fields" do subject.four = 4 expect do subject.check_required end.to raise_error end it "should not complain when required fields are set" do subject.four = 4 subject.two.b = "b" expect do subject.check_required end.to_not raise_error end end
Version data entries
19 entries across 19 versions & 1 rubygems