summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Peterson <dpeterson@spark.dpiddy.local>2007-11-23 21:06:46 -0700
committerDan Peterson <dpeterson@spark.dpiddy.local>2007-11-23 21:06:46 -0700
commitb435f04528c1107708f52f6110c7bce63fe6f37e (patch)
tree21bab6562c4c430e0b1b57e8fb1381a507b5ea78
parente53693e3ff244f8e782b5dc863aa659d46f9a286 (diff)
downloadpuppet-b435f04528c1107708f52f6110c7bce63fe6f37e.tar.gz
puppet-b435f04528c1107708f52f6110c7bce63fe6f37e.tar.xz
puppet-b435f04528c1107708f52f6110c7bce63fe6f37e.zip
fix socket argument to AR and add rails spec
-rw-r--r--lib/puppet/rails.rb2
-rw-r--r--spec/unit/rails.rb47
2 files changed, 48 insertions, 1 deletions
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index 55d03b878..e87e22a68 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -45,7 +45,7 @@ module Puppet::Rails
args[:username] = Puppet[:dbuser]
args[:password] = Puppet[:dbpassword]
args[:database] = Puppet[:dbname]
- args[:args] = Puppet[:dbsocket] unless Puppet[:dbsocket] == ""
+ args[:socket] = Puppet[:dbsocket] unless Puppet[:dbsocket] == ""
else
raise ArgumentError, "Invalid db adapter %s" % Puppet[:dbadapter]
end
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
new file mode 100644
index 000000000..9ffb4b537
--- /dev/null
+++ b/spec/unit/rails.rb
@@ -0,0 +1,47 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../spec_helper'
+require 'puppet/rails'
+
+describe Puppet::Rails, " when using sqlite3" do
+ setup do
+ @old_adapter = Puppet[:dbadapter]
+ @old_dbsocket = Puppet[:dbsocket]
+
+ Puppet[:dbadapter] = "sqlite3"
+ end
+
+ teardown do
+ Puppet[:dbadapter] = @old_adapter
+ Puppet[:dbsocket] = @old_dbsocket
+ end
+
+ it "should ignore the database socket argument" do
+ Puppet[:dbsocket] = "blah"
+ Puppet::Rails.database_arguments[:socket].should be_nil
+ end
+end
+
+describe Puppet::Rails, " when not using sqlite3" do
+ setup do
+ @old_adapter = Puppet[:dbadapter]
+ @old_dbsocket = Puppet[:dbsocket]
+
+ Puppet[:dbadapter] = "mysql"
+ end
+
+ teardown do
+ Puppet[:dbadapter] = @old_adapter
+ Puppet[:dbsocket] = @old_dbsocket
+ end
+
+ it "should set the dbsocket argument if not empty " do
+ Puppet[:dbsocket] = "blah"
+ Puppet::Rails.database_arguments[:socket].should == "blah"
+ end
+
+ it "should not set the dbsocket argument if empty" do
+ Puppet[:dbsocket] = ""
+ Puppet::Rails.database_arguments[:socket].should be_nil
+ end
+end \ No newline at end of file