Sha256: f237d4ab0459f2df231a118a921d3943a85fbb3c9135738ca9f88e39ce818e52
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
# # This file is part of the lazier gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>. # Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit. # require "spec_helper" describe Lazier::Configuration do class ConfigurationSpecSample < ::Lazier::Configuration property :readwrite, default: "1" property :required, required: true property :readonly, default: "2", readonly: true end describe "#property" do it "should correctly define property and get it defaults" do expect(ConfigurationSpecSample.new(required: 1).readwrite).to eq("1") expect(ConfigurationSpecSample.new(required: 1, readwrite: "3").readwrite).to eq("3") expect(ConfigurationSpecSample.new(required: 1).readonly).to eq("2") expect(ConfigurationSpecSample.new(required: 1, readonly: "4").readonly).to eq("4") end it "should not allow writing readonly properties" do subject = ConfigurationSpecSample.new(required: 1) expect { subject.readonly = "4" }.to raise_error(ArgumentError) expect(subject.readonly).to eq("2") end it "should blow up for required properties" do expect { ConfigurationSpecSample.new }.to raise_error(ArgumentError) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lazier-4.2.9 | spec/lazier/configuration_spec.rb |
lazier-4.2.8 | spec/lazier/configuration_spec.rb |
lazier-4.2.3 | spec/lazier/configuration_spec.rb |