Sha256: 7fd0b001528a3e9b613606337f6f1874e1b996a67fc5c0fd47d22b2d3ca18aeb

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require 'spec/spec_helper'

describe Upstart::Exporter::Options::Validator do

  it "validates paths" do
    validator = described_class.new(:helper_dir => "/some/dir;")
    expect {validator.call}.to raise_error(Upstart::Exporter::Error)
  end

  it "validates user names" do
    validator = described_class.new(:run_user => "bad_user_name!")
    expect {validator.call}.to raise_error(Upstart::Exporter::Error)
  end

  it "validates runlevels" do
    validator = described_class.new(:start_on_runlevel => "[not_a_digit]")
    expect {validator.call}.to raise_error(Upstart::Exporter::Error)
  end

  describe "procfile v2" do
    it "validates respawn" do
      options = {:procfile_commands => {:version => 2, :respawn => {:count => "10;"}}}
      validator = described_class.new(options)
      expect {validator.call}.to raise_error(Upstart::Exporter::Error)
    end

    it "validates options for individual commands" do
      options = {
        :procfile_commands => {:version => 2,
          :commands => {
            :come_cmd => {
              :working_directory => "!!!wrong_working-directory"
            }
          }
        }
      }
      validator = described_class.new(options)
      expect {validator.call}.to raise_error(Upstart::Exporter::Error)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upstart-exporter-2.1.5 spec/lib/upstart-exporter/options/validator_spec.rb
upstart-exporter-2.1.4 spec/lib/upstart-exporter/options/validator_spec.rb