Sha256: 0417f43d339100ffacf11168f684bdb1d6f20a65ceb775d8d7ac876b1b75b9b5

Contents?: true

Size: 1.68 KB

Versions: 8

Compression:

Stored size: 1.68 KB

Contents

require 'rubygems'
require 'bundler'
require 'spork'
require "json_spec/cucumber"

Spork.prefork do
  require 'rspec'
  require 'pp'
  require 'aruba/cucumber'
  require 'vcr'

  APP_ROOT = File.expand_path('../../../', __FILE__)

  ENV["BERKSHELF_PATH"] = File.join(APP_ROOT, "tmp", "berkshelf")
  ENV["BERKSHELF_CHEF_CONFIG"] = File.join(APP_ROOT, "spec", "knife.rb")

  # Workaround for RSA Fingerprint prompt in Travis CI
  git_ssh_path = '/tmp/git_ssh.sh'
  unless File.exist? git_ssh_path
    git_ssh = File.new(git_ssh_path, 'w+')
    git_ssh.puts "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $1 $2"
    git_ssh.chmod 0775
    git_ssh.flush
    git_ssh.close
  end

  ENV["GIT_SSH"] = git_ssh_path


  Dir[File.join(APP_ROOT, "spec/support/**/*.rb")].each {|f| require f}

  Around do |scenario, block|
    VCR.use_cassette(scenario.name) do
      block.call
    end
  end

  Before do
    clean_cookbook_store
    @aruba_io_wait_seconds = 5
    @aruba_timeout_seconds = 16
  end

  Before('@slow_process') do
    @aruba_timeout_seconds = 60
    @aruba_io_wait_seconds = 10
  end

  def cookbook_store
    Pathname.new(File.join(ENV["BERKSHELF_PATH"],"cookbooks"))
  end

  def clean_cookbook_store
    FileUtils.rm_rf(cookbook_store)
    FileUtils.mkdir_p(cookbook_store)
  end

  def app_root_path
    Pathname.new(APP_ROOT)
  end

  def tmp_path
    app_root_path.join('spec/tmp')
  end

  def fixtures_path
    app_root_path.join('spec/fixtures')
  end

  # Set the output json_spec will parse for testing JSON responses
  def last_json
    all_output
  end
end

Spork.each_run do
  Berkshelf::RSpec::Knife.load_knife_config(File.join(APP_ROOT, 'spec/knife.rb'))

  require 'berkshelf'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
berkshelf-1.1.6 features/support/env.rb
berkshelf-1.1.5 features/support/env.rb
berkshelf-1.1.4 features/support/env.rb
berkshelf-1.1.3 features/support/env.rb
berkshelf-1.1.2 features/support/env.rb
berkshelf-1.1.1 features/support/env.rb
berkshelf-1.1.0 features/support/env.rb
berkshelf-1.1.0.rc1 features/support/env.rb