Sha256: 32c028322146acd33e08ce0b16f1b424895b49ccdd6ea3ef3c1be4a0a6f9ff5c
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
require 'helper' describe Prop::Options do describe "#build" do before do @args = { :key => "hello", :params => { :foo => "bif" }, :defaults => { :foo => "bar", :baz => "moo", :threshold => 10, :interval => 5 }} end describe "when given valid input" do before do @options = Prop::Options.build(@args) end it "support defaults" do assert_equal "moo", @options[:baz] end it "override defaults" do assert_equal "bif", @options[:foo] end end describe "when given invalid input" do it "raise when not given an interval" do @args[:defaults].delete(:interval) assert_raises(RuntimeError) { Prop::Options.build(@args) } end it "raise when not given a threshold" do @args[:defaults].delete(:threshold) assert_raises(RuntimeError) { Prop::Options.build(@args) } end it "raise when not given a key" do @args.delete(:key) begin Prop::Options.build(@args) fail "it puke when not given a valid key" rescue end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prop-1.1.0 | test/test_options.rb |
prop-1.0.2 | test/test_options.rb |
prop-1.0.1 | test/test_options.rb |