Commit 4107ff2

mo khan <mo@mokhan.ca>
2015-05-24 04:37:48
fix broken capistrano specs.
1 parent 5e5f436
Changed files (1)
spec/capistrano_spec.rb
@@ -1,40 +1,45 @@
-describe 'mokhan-myface::capistrano' do
+describe "mokhan-myface::capistrano" do
   subject do
     ChefSpec::SoloRunner.new do |node|
-      node.set['capistrano']['root_path'] = root_path
-      node.set['capistrano']['username'] = username
-      node.set['postgres']['database'] = 'app'
-      node.set['postgres']['username'] = username
-      node.set['postgres']['password'] = 'password'
-      node.set['postgres']['host'] = 'localhost'
+      node.set["capistrano"]["root_path"] = root_path
+      node.set["capistrano"]["username"] = username
+      node.set["postgres"]["database"] = "app"
+      node.set["postgres"]["username"] = username
+      node.set["postgres"]["password"] = "password"
+      node.set["postgres"]["host"] = "localhost"
     end.converge(described_recipe)
   end
   let(:root_path) { "/var/www/#{FFaker::Internet.domain_name}"  }
   let(:shared_path) { "#{root_path}/shared" }
-  let(:username) { 'deployer' }
+  let(:username) { "deployer" }
 
-  it 'creates the root directory for the application' do
+  before :each do
+    stub_command("stat -c %U #{root_path} | grep root").and_return(nil)
+  end
+
+  it "creates the root directory for the application" do
     expect(subject).to create_directory(root_path)
       .with_owner(username)
       .with_group(username)
       .with_mode("0755")
   end
 
-  it 'creates the shared directory for the application' do
+  it "creates the shared directory for the application" do
     expect(subject).to create_directory("#{root_path}/shared")
       .with_owner(username)
       .with_group(username)
       .with_mode("0755")
   end
 
-  it 'creates all the shared folders' do
+  it "creates all the shared folders" do
     directories = [
       "#{shared_path}/backups",
       "#{shared_path}/bundle",
       "#{shared_path}/config",
       "#{shared_path}/log",
-      "#{shared_path}/pids",
-      "#{shared_path}/sockets",
+      "#{shared_path}/tmp/sockets",
+      "#{shared_path}/tmp/pids",
+      "#{shared_path}/tmp/cache",
       "#{root_path}/releases"
     ]
     directories.each do |directory|
@@ -45,7 +50,7 @@ describe 'mokhan-myface::capistrano' do
     end
   end
 
-  it 'lays down the .env template' do
+  it "lays down the .env template" do
     expect(subject).to create_template("#{shared_path}/.env._default")
       .with_owner(username)
       .with_group(username)