Sha256: c52c874108b46a0ccf5c967f8c7973430272bbd3a533f105219bbf650c9bff68

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

require 'spec/spec_helper'

describe Upstart::Exporter::Templates do
  describe ".app" do
    it "should generate a valid app config" do
      
      conf = <<-HEREDOC
pre-start script

bash << "EOF"
  mkdir -p /var/log/SOMEAPP
  chown -R SOMEUSER /var/log/SOMEAPP
EOF

end script
HEREDOC

      described_class.app(:run_user => 'SOMEUSER', :app_name => 'SOMEAPP').should == conf
    end
  end

  describe ".helper" do
    it "should generate a valid helper script" do
      
      conf = <<-HEREDOC
#!/bin/sh
SOME COMMAND
HEREDOC

      described_class.helper(:cmd => 'SOME COMMAND').should == conf
    end
  end


  describe ".helper" do
    it "should generate a valid upstart script for a single command" do
      
      conf = <<-HEREDOC
start on starting SOMEAPP
stop on stopping SOMEAPP
respawn

script
  touch /var/log/SOMEAPP/SOMECMD.log
  chown SOMEUSER /var/log/SOMEAPP/SOMECMD.log
  exec sudo -u SOMEUSER /bin/sh HELPERPATH >> /var/log/SOMEAPP/SOMECMD.log 2>&1
end
HEREDOC

      described_class.command(:run_user => 'SOMEUSER', :app_name => 'SOMEAPP', :cmd_name => 'SOMECMD', :helper_cmd_conf => 'HELPERPATH').should == conf
    end
  end



end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
upstart-exporter-0.1.2 spec/lib/upstart-exporter/templates_spec.rb
upstart-exporter-0.1.1 spec/lib/upstart-exporter/templates_spec.rb
upstart-exporter-0.1.0 spec/lib/upstart-exporter/templates_spec.rb