Sha256: 97c1916dc242c767f7be2d071014483fbd9864356263584ce6afcad6eb003c60

Contents?: true

Size: 1.66 KB

Versions: 21

Compression:

Stored size: 1.66 KB

Contents

require 'rubygems'
require 'json'
require 'log4r'
require 'fakefs/spec_helpers'
require 'fileutils'
require_relative '../lib/depengine/helper/validations'
require_relative '../lib/depengine/helper/hudson'
require_relative '../lib/depengine/log/log'

$log       = Log::DeploymentLogger.new
#$log.writer.level = Log4r::ERROR

describe "helper functions" do
  include Helper
  include FakeFS::SpecHelpers

  it "should deliver all relevant envirnoment variables as a hash" do
    result = get_environemnt_variables
    result.should include("HOME")
  end

  it "should return a plain version number as a hash" do
    version = "1.2.3"
    result = parse_version(version)
    result['app'].should include("1.2.3")
  end

  it "should parse a json version string and return as hash" do
    version = "{\"app\": \"1.2.3\", \"cdb\": 23, \"depsw\": 44}"
    result = parse_version(version)
    result['app'].should include( "1.2.3" )
    result['cdb'].should  be 23
    result['depsw'].should be 44
  end

  it "should remove all files from workspace" do
    FileUtils.mkdir_p 'workspace'
    FileUtils.touch   'workspace/dummy.file'
    cleanup_workspace!('workspace')

    File.directory?( 'workspace' ).should be true
    File.file?( 'workspace/dummy.file' ).should be false
  end

  it "should create all inital directories in the workspace" do
    FileUtils.mkdir_p 'workspace'
    init_workspace('workspace')

    File.directory?( 'workspace' ).should be true
    File.directory?( 'workspace/source' ).should be true
    File.directory?( 'workspace/target' ).should be true
    File.directory?( 'workspace/config' ).should be true
    File.directory?( 'workspace/keep' ).should be true
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
depengine-3.0.20 spec/deployhelper_spec.rb
depengine-3.0.19 spec/deployhelper_spec.rb
depengine-3.0.18 spec/deployhelper_spec.rb
depengine-3.0.17 spec/deployhelper_spec.rb
depengine-3.0.16 spec/deployhelper_spec.rb
depengine-3.0.15 spec/deployhelper_spec.rb
depengine-3.0.14 spec/deployhelper_spec.rb
depengine-3.0.13 spec/deployhelper_spec.rb
depengine-3.0.12 spec/deployhelper_spec.rb
depengine-3.0.11 spec/deployhelper_spec.rb
depengine-3.0.10 spec/deployhelper_spec.rb
depengine-3.0.9 spec/deployhelper_spec.rb
depengine-3.0.8 spec/deployhelper_spec.rb
depengine-3.0.7 spec/deployhelper_spec.rb
depengine-3.0.6 spec/deployhelper_spec.rb
depengine-3.0.5 spec/deployhelper_spec.rb
depengine-3.0.4 spec/deployhelper_spec.rb
depengine-3.0.3 spec/deployhelper_spec.rb
depengine-3.0.2 spec/deployhelper_spec.rb
depengine-3.0.1 spec/deployhelper_spec.rb