Sha256: 5711631774aa1b3c01aabfdf323d218e452af8a940bbc3f3bdc850a1eebcf93d

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

# Copyright (c) 2012-2013 Stark & Wayne, LLC

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)

require "rubygems"
require "bundler"
Bundler.setup(:default, :test)

$:.unshift(File.expand_path("../../lib", __FILE__))

require "rspec/core"
require "tmpdir"

# for the #sh helper
require "rake"
require "rake/file_utils"

# bosh_cli
require "cli"

# load all files in spec/support/* (but not lower down)
Dir[File.dirname(__FILE__) + '/support/*'].each do |path|
  require path unless File.directory?(path)
end

def spec_asset(filename)
  File.expand_path("../assets/#{filename}", __FILE__)
end

def files_match(filename, expected_filename)
  file = File.read(filename)
  expected_file = File.read(expected_filename)
  file.should == expected_file
end

def yaml_files_match(filename, expected_filename)
  yaml = YAML.load_file(filename)
  expected_yaml = YAML.load_file(expected_filename)
  yaml.should == expected_yaml
end

def setup_home_dir
  home_dir = File.expand_path("../../tmp/home", __FILE__)
  FileUtils.rm_rf(home_dir)
  FileUtils.mkdir_p(home_dir)
  ENV['HOME'] = home_dir
end

# returns the file path to a file
# in the fake $HOME folder
def home_file(*path)
  File.join(ENV['HOME'], *path)
end

def in_home_dir(&block)
  FileUtils.chdir(home_file, &block)
end

def get_tmp_file_path(content)
  tmp_file = File.open(File.join(Dir.mktmpdir, "tmp"), "w")
  tmp_file.write(content)
  tmp_file.close

  tmp_file.path
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bosh-cloudfoundry-0.7.0.alpha.3 spec/spec_helper.rb
bosh-cloudfoundry-0.7.0.alpha.2 spec/spec_helper.rb
bosh-cloudfoundry-0.7.0.alpha.1 spec/spec_helper.rb