Sha256: 3e9554dbfe3dcf4de8f863cc93bda73835ad735f0e197aa9b0dd04f63d84a902

Contents?: true

Size: 1.82 KB

Versions: 15

Compression:

Stored size: 1.82 KB

Contents

LIB_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))

$LOAD_PATH.unshift LIB_DIR unless
  $LOAD_PATH.include?(LIB_DIR) || $LOAD_PATH.include?(File.expand_path(LIB_DIR))

require "brightbox_cli"
require "json"
require "tmpdir"

Dir["./spec/support/**/*.rb"].sort.each { |f| require f }

require "webmock/rspec"
WebMock.disable_net_connect!

# API_CLIENT_CONFIG_DIR = File.join(File.dirname(__FILE__), "configs/api_client")
# USER_APP_CONFIG_DIR   = File.join(File.dirname(__FILE__), "configs/user_application")

# API_CLIENT_CONFIG = Brightbox::BBConfig.new(:directory => API_CLIENT_CONFIG_DIR)
# USER_APP_CONFIG   = Brightbox::BBConfig.new(:directory => USER_APP_CONFIG_DIR)

# These are the contents
API_CLIENT_CONFIG_CONTENTS = File.read(File.join(File.dirname(__FILE__), "configs/api_client.ini"))
USER_APP_CONFIG_CONTENTS = File.read(File.join(File.dirname(__FILE__), "configs/user_app.ini"))

# Remember the $HOME of the test runner
TEST_RUNNER_HOME = ENV["HOME"]

RSpec.configure do |config|
  config.include CommonHelpers
  config.include ConfigHelpers
  config.include TokenHelpers
  config.include PasswordPromptHelpers

  config.before do
    # For each test, point to the testing endpoint to make it safer and easier to
    # record from dev endpoints. Devs can DNS api.brightbox.dev to their dev service
    stub_const("Brightbox::DEFAULT_API_ENDPOINT", ENV["BRIGHTBOX_API_URL"] || "http://api.brightbox.dev")
    # And set a sane terminal size for Hirb
    ENV["COLUMNS"] = "120"
    ENV["LINES"] = "120"
  end

  # For each test, isolate the testing users $HOME so that we control the config
  # and any cached values completely.
  config.around(:each) do |example|
    Dir.mktmpdir do |tmp_home|
      ENV["HOME"] = tmp_home
      Brightbox.config = nil
      example.run
      ENV["HOME"] = TEST_RUNNER_HOME
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
brightbox-cli-3.3.0 spec/spec_helper.rb
brightbox-cli-3.2.0 spec/spec_helper.rb
brightbox-cli-3.1.0 spec/spec_helper.rb
brightbox-cli-3.0.1 spec/spec_helper.rb
brightbox-cli-3.0.0 spec/spec_helper.rb
brightbox-cli-2.12.0 spec/spec_helper.rb
brightbox-cli-2.11.2 spec/spec_helper.rb
brightbox-cli-2.11.1 spec/spec_helper.rb
brightbox-cli-2.11.0 spec/spec_helper.rb
brightbox-cli-2.10.0 spec/spec_helper.rb
brightbox-cli-2.9.3 spec/spec_helper.rb
brightbox-cli-2.9.2 spec/spec_helper.rb
brightbox-cli-2.9.1 spec/spec_helper.rb
brightbox-cli-2.9.0 spec/spec_helper.rb
brightbox-cli-2.8.2 spec/spec_helper.rb