Sha256: af849f39c09ccca489c648530c15c31fabe7d62e3c41db49fbded371758094a5

Contents?: true

Size: 1.66 KB

Versions: 4

Compression:

Stored size: 1.66 KB

Contents

if ENV['COVERAGE'] == "on"
  require 'simplecov'
  require 'simplecov-rcov'
  SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
  unless SimpleCov.running   # Hack to prevent starting SimpleCov multiple times  see: https://github.com/simplecov-ruby/simplecov/issues/1003
    SimpleCov.start do
      add_filter '/vendor'
      add_filter '/spec'
      add_filter '/test'
    end
  end
end

require "rubygems"
require "rspec"
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.include WebMock::API
  config.include StubApiRequests

  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 }
  config.color = true
end

def jruby?
  RUBY_PLATFORM == "java"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spark_api-1.6.3 spec/spec_helper.rb
spark_api-1.6.2 spec/spec_helper.rb
spark_api-1.6.1 spec/spec_helper.rb
spark_api-1.6.0 spec/spec_helper.rb