diff options
Diffstat (limited to 'spec/unit/rails/resource.rb')
-rwxr-xr-x | spec/unit/rails/resource.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/unit/rails/resource.rb b/spec/unit/rails/resource.rb index eaead2e3d..9e2ff8cd2 100755 --- a/spec/unit/rails/resource.rb +++ b/spec/unit/rails/resource.rb @@ -38,5 +38,50 @@ describe "Puppet::Rails::Resource" do Puppet::Rails::Resource.rails_resource_initial_args(resource)[:exported].should be_true end + + it "should set 'exported' to false of the resource is not exported" do + resource = Puppet::Resource.new(:file, "/file") + resource.exported = false + + Puppet::Rails::Resource.rails_resource_initial_args(resource)[:exported].should be_false + + resource = Puppet::Resource.new(:file, "/file") + resource.exported = nil + + Puppet::Rails::Resource.rails_resource_initial_args(resource)[:exported].should be_false + end + end + + describe "when merging in a parser resource" do + before do + @parser = mock 'parser resource' + + @resource = Puppet::Rails::Resource.new + [:merge_attributes, :merge_parameters, :merge_tags, :save].each { |m| @resource.stubs(m) } + end + + it "should merge the attributes" do + @resource.expects(:merge_attributes).with(@parser) + + @resource.merge_parser_resource(@parser) + end + + it "should merge the parameters" do + @resource.expects(:merge_parameters).with(@parser) + + @resource.merge_parser_resource(@parser) + end + + it "should merge the tags" do + @resource.expects(:merge_tags).with(@parser) + + @resource.merge_parser_resource(@parser) + end + + it "should save itself" do + @resource.expects(:save) + + @resource.merge_parser_resource(@parser) + end end end |