Sha256: ce91ba1f88910d295338be2362ada1e5fbc25fe6c37a069fd202b4634f9f6529

Contents?: true

Size: 1012 Bytes

Versions: 1

Compression:

Stored size: 1012 Bytes

Contents

ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] ||= File.join(File.dirname(__FILE__), 'mock_app')

require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config', 'environment.rb'))

require 'spec'
require 'spec/rails'
require 'rake'
require 'ruby-debug' unless RUBY_VERSION =~ /1\.9/
require 'sunspot/rails/tasks'
require 'sunspot/spec/extension'

def load_schema
  stdout = $stdout
  $stdout = StringIO.new # suppress output while building the schema
  load File.join(File.dirname(__FILE__), 'schema.rb')
  $stdout = stdout
end

def silence_stderr(&block)
  stderr = $stderr
  $stderr = StringIO.new
  yield
  $stderr = stderr
end

Spec::Runner.configure do |config|
  config.before(:each) do
    if integrate_sunspot?
      Sunspot.remove_all
      Sunspot.commit
    end
    load_schema
  end
end

module Spec
  module Mocks
    module Methods
      def should_respond_to_and_receive(*args, &block)
        respond_to?(args.first).should ==(true)
        should_receive(*args, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benjaminkrause-sunspot_rails-0.10.5 spec/spec_helper.rb