spec/parameters_spec.rb in parameters-0.1.0 vs spec/parameters_spec.rb in parameters-0.1.1

- old
+ new

@@ -11,10 +11,12 @@ parameter :var_with_default, :default => 'thing', :description => 'This parameter has a default value' + parameter :var_without_default, + :description => 'This parameter does not have a default value' end class InheritedParameters < TestParameters parameter :child_var, :description => 'Child parameter' @@ -114,16 +116,22 @@ it "should raise a ParamNotFound exception when directly accessing non-existent parameter objects" do lambda { @test.get_param(:unknown) }.should raise_error(Parameters::ParamNotFound) end it "should allow for setting parameters en-mass" do - @test.set_params(:var => 3, :var_with_default => 7) + @test.params = {:var => 3, :var_with_default => 7} @test.param_value(:var).should == 3 @test.param_value(:var_with_default).should == 7 end it "should provide descriptions for parameters" do @test.describe_param(:var).should_not be_empty + end + + it "should require that certain parameters have non nil values" do + lambda { + @test.instance_eval { require_params(:var_without_default) } + }.should raise_error(Parameters::MissingParam) end end end