Sha256: e474aee1bc232be43457f47ba21b3b0bb86576d5e0e2a491bf4704b28d1bd182

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

# encoding: UTF-8

require 'pathname'

path = Pathname.new(File.expand_path('../../contactology.yml', __FILE__))

if path.exist?
  begin
    CONTACTOLOGY_CONFIGURATION = YAML.load_file(path)
    Contactology.configure do |config|
      config.key = CONTACTOLOGY_CONFIGURATION['key'] || abort("Contactology configuration file (#{path}) is missing the key value.")
      config.endpoint = CONTACTOLOGY_CONFIGURATION['endpoint'] if CONTACTOLOGY_CONFIGURATION.has_key?('endpoint')
    end
  rescue NoMethodError
    abort "Contactology configuration file (#{path}) is malformatted or unreadable."
  end
else
  abort "Contactology test configuration (#{path}) not found."
end

module ConfigurationSpecHelpers
  def maintain_contactology_configuration
    before(:each) do
      @_isolated_configuration = Contactology.configuration
      Contactology.configuration = @_isolated_configuration.dup
    end

    after(:each) do
      Contactology.configuration = @_isolated_configuration
    end
  end
end

RSpec.configure do |config|
  config.extend ConfigurationSpecHelpers
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contactology-1.0.0 spec/support/contactology.rb
contactology-0.1.2 spec/support/contactology.rb
contactology-0.1.1 spec/support/contactology.rb
contactology-0.1.0 spec/support/contactology.rb
contactology-0.0.2 spec/support/contactology.rb