Sha256: 5a4341cb93abb284c2ea1e1bb403fb3b0809d7d3000a2f4dfec21b51317a46a9

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 KB

Contents

require 'rubygems'         # rubygems/version doesn't work by itself
require 'rubygems/version' # for simplecov-html
require 'simplecov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
  add_filter '/bundle/'
end

gem 'minitest' if defined? Bundler
require 'minitest/autorun'

if ENV['LEFTRIGHT']
  begin
    require 'leftright'
  rescue LoadError
    puts "Run `gem install leftright` to install leftright."
  end
end

require File.expand_path('../../lib/faraday', __FILE__)

require 'stringio'
require 'uri'

module Faraday
  module LiveServerConfig
    def live_server=(value)
      @@live_server = case value
      when /^http/
        URI(value)
      when /./
        URI('http://127.0.0.1:4567')
      end
    end

    def live_server?
      defined? @@live_server
    end

    # Returns an object that responds to `host` and `port`.
    def live_server
      live_server? and @@live_server
    end
  end

  class TestCase < MiniTest::Test
    extend LiveServerConfig
    self.live_server = ENV['LIVE']

    def test_default
      assert true
    end unless defined? ::MiniTest

    def capture_warnings
      old, $stderr = $stderr, StringIO.new
      begin
        yield
        $stderr.string
      ensure
        $stderr = old
      end
    end

    def self.jruby?
      defined? RUBY_ENGINE and 'jruby' == RUBY_ENGINE
    end

    def self.rbx?
      defined? RUBY_ENGINE and 'rbx' == RUBY_ENGINE
    end

    def self.ssl_mode?
      ENV['SSL'] == 'yes'
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
whos_dated_who-0.1.0 vendor/bundle/gems/faraday-0.9.0/test/helper.rb
whos_dated_who-0.0.1 vendor/bundle/gems/faraday-0.9.0/test/helper.rb
faraday-0.9.0 test/helper.rb
faraday-0.9.0.rc7 test/helper.rb
faraday-0.9.0.rc6 test/helper.rb