spec/spec_helper.rb in invoker-1.0.4 vs spec/spec_helper.rb in invoker-1.1.0

- old
+ new

@@ -1,31 +1,28 @@ require "pry" -require 'coveralls' -Coveralls.wear! +require "simplecov" +SimpleCov.start do + add_filter "/spec/" +end + require "invoker" +require "invoker/power/power" +MM = Invoker::IPC::Message -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# Require this file using `require "spec_helper"` to ensure that it is only -# loaded once. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - config.expect_with :rspec do |c| - c.syntax = :expect - end config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus config.mock_framework = :mocha config.before(:each) do @original_verbosity = $VERBOSE $VERBOSE = nil @old_config = Invoker::Power::Config::CONFIG_LOCATION - Invoker::Power::Config.const_set(:CONFIG_LOCATION, "/tmp/.invoker") + Invoker::Power::Config.const_set(:CONFIG_LOCATION, "/tmp/.invoker/config") + FileUtils.mkdir("/tmp/.invoker") unless Dir.exist?("/tmp/.invoker") File.exists?(Invoker::Power::Config::CONFIG_LOCATION) && File.delete(Invoker::Power::Config::CONFIG_LOCATION) @old_resolver = Invoker::Power::Setup::RESOLVER_FILE @@ -63,21 +60,15 @@ end ENV["INVOKER_TESTS"] = "true" def invoker_config - if Invoker.const_defined?(:CONFIG) - Invoker::CONFIG - else - Invoker.const_set(:CONFIG, mock()) - Invoker::CONFIG - end + Invoker.config ||= mock end def invoker_commander - if Invoker.const_defined?(:COMMANDER) - Invoker::COMMANDER - else - Invoker.const_set(:COMMANDER, mock()) - Invoker::COMMANDER - end + Invoker.commander ||= mock +end + +def invoker_dns_cache + Invoker.dns_cache ||= mock end