diff options
author | Dan Peterson <dpeterson@spark.dpiddy.local> | 2007-11-23 21:06:46 -0700 |
---|---|---|
committer | Dan Peterson <dpeterson@spark.dpiddy.local> | 2007-11-23 21:06:46 -0700 |
commit | b435f04528c1107708f52f6110c7bce63fe6f37e (patch) | |
tree | 21bab6562c4c430e0b1b57e8fb1381a507b5ea78 /spec/unit/rails.rb | |
parent | e53693e3ff244f8e782b5dc863aa659d46f9a286 (diff) | |
download | puppet-b435f04528c1107708f52f6110c7bce63fe6f37e.tar.gz puppet-b435f04528c1107708f52f6110c7bce63fe6f37e.tar.xz puppet-b435f04528c1107708f52f6110c7bce63fe6f37e.zip |
fix socket argument to AR and add rails spec
Diffstat (limited to 'spec/unit/rails.rb')
-rw-r--r-- | spec/unit/rails.rb | 47 |
1 files changed, 47 insertions, 0 deletions
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 |