features/support/env.rb in berkshelf-0.1.1 vs features/support/env.rb in berkshelf-0.1.2
- old
+ new
@@ -1,8 +1,7 @@
require 'rubygems'
require 'bundler'
-Bundler.setup
require 'spork'
Spork.prefork do
require 'rspec'
require 'pp'
@@ -10,23 +9,29 @@
require 'vcr'
APP_ROOT = File.expand_path('../../../', __FILE__)
ENV["BERKSHELF_PATH"] = File.join(APP_ROOT, "tmp", "berkshelf")
+
+ begin
+ CONFIG = YAML.load(File.read(File.join(APP_ROOT, "features", "config.yml")))
+ rescue Errno::ENOENT
+ raise "Please create a config file at features/config.yml from the sample found at features/config.sample.yml"
+ end
Dir[File.join(APP_ROOT, "spec/support/**/*.rb")].each {|f| require f}
Around do |scenario, block|
VCR.use_cassette(scenario.title) do
block.call
end
end
Before do
- Chef::Config[:chef_server_url] = config['chef_server_url']
- Chef::Config[:client_key] = config['client_key']
- Chef::Config[:node_name] = config['node_name']
+ Chef::Config[:chef_server_url] = CONFIG['chef_server_url']
+ Chef::Config[:client_key] = CONFIG['client_key']
+ Chef::Config[:node_name] = CONFIG['node_name']
clean_cookbook_store
@aruba_io_wait_seconds = 5
end
Before('@slow_process') do
@@ -41,13 +46,15 @@
def clean_cookbook_store
FileUtils.rm_rf(cookbook_store)
FileUtils.mkdir_p(cookbook_store)
end
- def config
- @config ||= YAML.load(File.read(File.join(APP_ROOT, "features", "config.yml")))
- rescue Errno::ENOENT
- raise "Please create a config file at features/config.yml from the sample found at features/config.sample.yml"
+ def app_root_path
+ Pathname.new(APP_ROOT)
+ end
+
+ def fixtures_path
+ app_root_path.join('spec/fixtures')
end
end
Spork.each_run do
require 'berkshelf'