Sha256: 3f03d185fef32ebe956cfc5a93147c5b9ccf4e6996b5b74a0a2ead237fde7b56
Contents?: true
Size: 1.24 KB
Versions: 9
Compression:
Stored size: 1.24 KB
Contents
require 'helper' class TestOptions < Test::Unit::TestCase context Prop::Options do context "#build" do setup do @args = { :key => "hello", :params => { :foo => "bif" }, :defaults => { :foo => "bar", :baz => "moo", :threshold => 10, :interval => 5 }} end context "when given valid input" do setup do @options = Prop::Options.build(@args) end should "support defaults" do assert_equal "moo", @options[:baz] end should "override defaults" do assert_equal "bif", @options[:foo] end end context "when given invalid input" do should "raise when not given an interval" do @args[:defaults].delete(:interval) assert_raises(RuntimeError) { Prop::Options.build(@args) } end should "raise when not given a threshold" do @args[:defaults].delete(:threshold) assert_raises(RuntimeError) { Prop::Options.build(@args) } end should "raise when not given a key" do @args.delete(:key) begin Prop::Options.build(@args) fail "Should puke when not given a valid key" rescue end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems