Sha256: 5aae73fbf10fcab92fb69c250a312e1c7956b5d6aa681622b621348c095fc127

Contents?: true

Size: 1.77 KB

Versions: 4

Compression:

Stored size: 1.77 KB

Contents

require 'rubygems'
require 'spec'
require 'rack'
require 'fileutils'

require File.dirname(__FILE__) + '/../lib/dragonfly'
$:.unshift(File.dirname(__FILE__))
require 'argument_matchers'
require 'simple_matchers'
require 'image_matchers'

ROOT_PATH = File.expand_path(File.dirname(__FILE__) + "/..") unless defined?(ROOT_PATH)

# A hack as system calls weren't using my path
extra_paths = %w(/opt/local/bin)
ENV['PATH'] ||= ''
ENV['PATH'] += ':' + extra_paths.join(':')

# If this is jRuby, ignore the rmagick tests
ENV['IGNORE_RMAGICK'] = 'true' if RUBY_PLATFORM == 'java' || defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'

SAMPLES_DIR = File.expand_path(File.dirname(__FILE__) + '/../samples') unless defined?(SAMPLES_DIR)

Spec::Runner.configure do |c|
  c.after(:all){ Dir["#{ROOT_PATH}/Gemfile*.lock"].each{|f| FileUtils.rm_f(f) } }
end

def todo
  raise "TODO"
end

require 'logger'
LOG_FILE = File.dirname(__FILE__) + '/spec.log' unless defined?(LOG_FILE)
FileUtils.rm_rf(LOG_FILE)
def mock_app(extra_stubs={})
  mock('app', {
    :datastore => mock('datastore', :store => 'some_uid', :retrieve => ["SOME_DATA", {}], :destroy => nil),
    :processor => mock('processor', :process => "SOME_PROCESSED_DATA"),
    :encoder => mock('encoder', :encode => "SOME_ENCODED_DATA"),
    :analyser => mock('analyser', :analyse => "some_result", :analysis_methods => Module.new),
    :generator => mock('generator', :generate => "SOME_GENERATED_DATA"),
    :log => Logger.new(LOG_FILE),
    :cache_duration => 10000,
    :job_definitions => Module.new
  }.merge(extra_stubs)
  )
end

def test_app
  Dragonfly::App.send(:new)
end

def suppressing_stderr
  original_stderr = $stderr.dup
  tempfile = Tempfile.new('stderr')
  $stderr.reopen(tempfile)
  yield
ensure
  tempfile.close
  $stderr.reopen(original_stderr)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dragonfly-0.8.6 spec/spec_helper.rb
dragonfly-0.8.5 spec/spec_helper.rb
dragonfly-0.8.4 spec/spec_helper.rb
dragonfly-0.8.2 spec/spec_helper.rb