Sha256: 9b4e7366d1b7ca9205d5135e7d754762673aa8dfa3efcceb0cb458e1ba886006

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
ENV['RACK_ENV'] = 'test'
require 'rspec'
require 'database_cleaner'
#require 'webmock/rspec'
require 'debugger'
require File.join(File.dirname(__FILE__), '../lib', 'perkins')
require "pry"
require "git"
require 'rack/test'

require "support/auth"
require "support/github_api"

require 'dotenv'
Dotenv.load

RSpec.configure do |config|

  config.include(Rack::Test::Methods)
  config.include(SinatraAuthGithubTestHelper)

  def perkins_app
    Perkins.application() do |app|
      config do |c|
        c.redis = {namespace: "perkins:test"}
        c.database = "./examples/database.yml"
        #c.server = { host: "localhost", port:1234 }
        c.github_client_id = ENV['GITHUB_CLIENT_ID']
        c.github_client_secret = ENV['GITHUB_SECRET']
      end
    end
  end

  #WebMock.disable_net_connect!(:allow => 'coveralls.io')

  config.raise_errors_for_deprecations!

  config.before(:all) do
    perkins_app
    @test_repo = "#{test_github_login}/#{test_github_repository}"
    @test_org_repo = "#{test_github_org}/#{test_github_repository}"
  end

  config.before(:suite) do
    perkins_app
    DatabaseCleaner.clean_with(:truncation)
  end

  # this runs before each *_spec.rb, not before ALL specs
  config.before(:all) do
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.strategy = :transaction
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  #config.after(:each) do
  #  DatabaseCleaner.clean
  #end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
perkins-0.0.1 spec/spec_helper.rb