summaryrefslogtreecommitdiffstats
path: root/spec/unit/rails/resource.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-06-01 17:50:55 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-06-03 07:33:33 +1000
commit650029e3730431dcc21863d92fd50c74665cea38 (patch)
treee0c4b77c10a6a199ffc8331b2ac29df731b4bd2a /spec/unit/rails/resource.rb
parentf1dba91bbde7919cb0a0fd412faacb1f7dd2c84d (diff)
downloadpuppet-650029e3730431dcc21863d92fd50c74665cea38.tar.gz
puppet-650029e3730431dcc21863d92fd50c74665cea38.tar.xz
puppet-650029e3730431dcc21863d92fd50c74665cea38.zip
Always providing a value for 'exported' on Rails resources
We often didn't set a value, unless it was true, which meant that if it had previously been true but was now false, we didn't fix it. We also were not always saving modified resources, which in some cases resulted in work not getting saved. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/rails/resource.rb')
-rwxr-xr-xspec/unit/rails/resource.rb45
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