Sha256: 9a229a9822ef5f1ef84fc649b9caf06ae66304d892bf91e66f444eff827d4fb8

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

if ENV['COVERAGE'] == "on"
  require 'simplecov'
  require 'simplecov-rcov'
  SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
  SimpleCov.start do
    add_filter '/vendor'
    add_filter '/spec'
    add_filter '/test'
  end
end

require "rubygems"
require "rspec"
require 'rspec/autorun'
require 'webmock/rspec'
require "json"
require 'multi_json'

path = File.expand_path(File.dirname(__FILE__) + "/../lib/")
$LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
require path + '/spark_api'

require 'spark_api'

FileUtils.mkdir 'log' unless File.exists? 'log'

module SparkApi
  def self.logger
    if @logger.nil?
      @logger = Logger.new('log/test.log')
      @logger.level = Logger::DEBUG
    end
    @logger
  end
end

SparkApi.logger.info("Setup gem for rspec testing")

include SparkApi::Models

def reset_config
  SparkApi.reset
  SparkApi.configure { |c| c.api_user = "foobar" }
end

# Requires supporting ruby files with custom matchers and macros, etc,
# # in spec/support/ and its subdirectories.
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.alias_example_to :on_get_it, :method => 'GET'
  config.alias_example_to :on_put_it, :method => 'PUT'
  config.alias_example_to :on_post_it, :method => 'POST'
  config.alias_example_to :on_delete_it, :method => 'DELETE'
  config.before(:all) { reset_config }
end

def jruby? 
  RUBY_PLATFORM == "java"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spark_api-1.3.26 spec/spec_helper.rb
spark_api-1.3.25 spec/spec_helper.rb