Sha256: d23f300ef8e6b1b2421122157919d731ff517f4563940bff814e5aec3657629e

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)

$dir = File.dirname(File.expand_path(__FILE__))

require 'rspec/rails'
require 'rexml/document'

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

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.before(:suite) do
    # Make sure we can run redis
    if !system("which redis-server")
      puts '', "** can't find `redis-server` in your path"
      abort ''
    end

    # Start redis
    puts "Starting redis for testing at localhost:9736"
    `redis-server #{$dir}/support/redis/redis-test.conf`
    QuickbooksWebConnector.redis = 'localhost:9736'
  end

  config.before(:each) do
    QuickbooksWebConnector.redis.flushall
  end

  # Kill our own redis we started
  config.after(:suite) do
    processes = `ps -A -o pid,command | grep [r]edis-test`.split($/)
    pids = processes.map { |process| process.split(" ")[0] }
    puts '', "Killing test redis server..."
    pids.each { |pid| Process.kill("TERM", pid.to_i) }
    system("rm -f #{$dir}/support/redis/dump.rdb")
  end
end

# fixture classes
class SomeBuilder
  def self.perform(*args)
  end
end

class SomeHandler
  def self.perform(response_xml, *args)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
quickbooks_web_connector-0.5.0 spec/spec_helper.rb
quickbooks_web_connector-0.4.0 spec/spec_helper.rb
quickbooks_web_connector-0.3.0 spec/spec_helper.rb
quickbooks_web_connector-0.2.0 spec/spec_helper.rb
quickbooks_web_connector-0.1.0 spec/spec_helper.rb
quickbooks_web_connector-0.0.6 spec/spec_helper.rb
quickbooks_web_connector-0.0.5 spec/spec_helper.rb
quickbooks_web_connector-0.0.4 spec/spec_helper.rb