Sha256: 94d045b2b77d5c54b93f24d3b3e24ca411d70246200d73737201ee5fc325cbdc

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

ENV['RUBY_ENV'] ||= 'test'
ENV['MOTHERBRAIN_PATH'] ||= File.join(File.expand_path("../../", File.dirname(__FILE__)), "spec/tmp/.mb")
ENV['BERKSHELF_PATH'] ||= File.join(File.expand_path("../../", File.dirname(__FILE__)), "spec/tmp/.berkshelf")
ENV['CHEF_API_URL'] = 'http://localhost:28891'

require 'rubygems'
require 'bundler'
require 'motherbrain'

def setup_env
  require 'rspec'
  require 'aruba/cucumber'
  require 'aruba/in_process'
  require 'aruba/spawn_process'
  require 'chef_zero/server'

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

  RSpec.configure do |config|
    config.include MotherBrain::SpecHelpers

    config.before(:each) do
      clean_tmp_path
    end
  end

  Aruba::InProcess.main_class = MB::Cli::Runner
  Aruba.process               = Aruba::InProcess

  World(Aruba::Api)
  World(MotherBrain::SpecHelpers)
  World(MotherBrain::RSpec::ChefServer)

  WebMock.disable_net_connect!(allow_localhost: true, net_http_connect_on_start: true)
  MB::RSpec::ChefServer.start

  at_exit { MB::RSpec::ChefServer.stop }

  Before do
    Celluloid.boot
    @aruba_timeout_seconds = 30
    @config = generate_valid_config
  end

  Before('@in-process') do
    Aruba.process = Aruba::InProcess
  end

  Before('@spawn') do
    Aruba.process = Aruba::SpawnProcess
  end
end

if jruby?
  setup_env
else
  require 'spork'

  Spork.prefork do
    setup_env
  end

  Spork.each_run do
    require 'motherbrain'

    World(MB::Mixin::CodedExit)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
motherbrain-1.5.0 features/support/env.rb
motherbrain-1.4.0 features/support/env.rb
motherbrain-1.3.0 features/support/env.rb
motherbrain-1.2.1 features/support/env.rb
motherbrain-1.2.0 features/support/env.rb
motherbrain-1.1.3 features/support/env.rb
motherbrain-1.1.2 features/support/env.rb
motherbrain-1.1.1 features/support/env.rb
motherbrain-1.1.0 features/support/env.rb
motherbrain-1.0.0 features/support/env.rb
motherbrain-0.14.5 features/support/env.rb
motherbrain-0.14.4 features/support/env.rb
motherbrain-0.14.3 features/support/env.rb
motherbrain-0.14.2 features/support/env.rb
motherbrain-0.13.1 features/support/env.rb