summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorAvi Miller <avi.miller@gmail.com>2009-10-02 21:55:35 +1000
committerJames Turnbull <james@lovedthanlost.net>2009-10-24 08:36:58 +1100
commitc61335f66f897bc64992c4e9209ea517193c8e30 (patch)
tree16e53b465cf88fd6162f7e73fea045b189bc0fa9 /spec/unit
parentaea1e5fa34412dd843b937263d92c4fab9628b83 (diff)
downloadpuppet-c61335f66f897bc64992c4e9209ea517193c8e30.tar.gz
puppet-c61335f66f897bc64992c4e9209ea517193c8e30.tar.xz
puppet-c61335f66f897bc64992c4e9209ea517193c8e30.zip
Patch to address feature #2571 to add Oracle support to Puppet
Adapter requires specifying database, username and password. Signed-off-by: Avi Miller <avi.miller@gmail.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/rails.rb81
1 files changed, 80 insertions, 1 deletions
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
index d98c88774..d838f0b8f 100755
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@ -76,7 +76,7 @@ describe Puppet::Rails, "when initializing a sqlite3 connection" do
end
end
-describe Puppet::Rails, "when initializing a mysql or postgresql connection" do
+describe Puppet::Rails, "when initializing a mysql connection" do
confine "Cannot test without ActiveRecord" => Puppet.features.rails?
it "should provide the adapter, log_level, and host, username, password, and database arguments" do
@@ -118,3 +118,82 @@ describe Puppet::Rails, "when initializing a mysql or postgresql connection" do
}
end
end
+
+describe Puppet::Rails, "when initializing a postgresql connection" do
+ confine "Cannot test without ActiveRecord" => Puppet.features.rails?
+
+ it "should provide the adapter, log_level, and host, username, password, and database arguments" do
+ Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
+ Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
+ Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
+ Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
+ Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
+ Puppet.settings.stubs(:value).with(:dbname).returns("testname")
+ Puppet.settings.stubs(:value).with(:dbsocket).returns("")
+
+ Puppet::Rails.database_arguments.should == {
+ :adapter => "postgresql",
+ :log_level => "testlevel",
+ :host => "testserver",
+ :username => "testuser",
+ :password => "testpassword",
+ :database => "testname"
+ }
+ end
+
+ it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do
+ Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
+ Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
+ Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
+ Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
+ Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
+ Puppet.settings.stubs(:value).with(:dbname).returns("testname")
+ Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
+
+ Puppet::Rails.database_arguments.should == {
+ :adapter => "postgresql",
+ :log_level => "testlevel",
+ :host => "testserver",
+ :username => "testuser",
+ :password => "testpassword",
+ :database => "testname",
+ :socket => "testsocket"
+ }
+ end
+end
+
+describe Puppet::Rails, "when initializing an Oracle connection" do
+ confine "Cannot test without ActiveRecord" => Puppet.features.rails?
+
+ it "should provide the adapter, log_level, and username, password, and database arguments" do
+ Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
+ Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
+ Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
+ Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
+ Puppet.settings.stubs(:value).with(:dbname).returns("testname")
+
+ Puppet::Rails.database_arguments.should == {
+ :adapter => "oracle_enhanced",
+ :log_level => "testlevel",
+ :username => "testuser",
+ :password => "testpassword",
+ :database => "testname"
+ }
+ end
+
+ it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do
+ Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
+ Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
+ Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
+ Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
+ Puppet.settings.stubs(:value).with(:dbname).returns("testname")
+
+ Puppet::Rails.database_arguments.should == {
+ :adapter => "oracle_enhanced",
+ :log_level => "testlevel",
+ :username => "testuser",
+ :password => "testpassword",
+ :database => "testname",
+ }
+ end
+end