Sha256: 663d871b67c358bd54271101c9362c01bb3f8e32350fa6c82620dff7b8414251

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

if rails_version = ENV['RAILS_VERSION']
  require 'rubygems'
  gem "rails", rails_version
end

require "rails/version"
puts "==== Testing with Rails #{Rails::VERSION::STRING} ===="

require 'bundler'
Bundler.require
require 'ostruct'
require 'relevance/tarantula'

def test_output_dir
  File.join(File.dirname(__FILE__), "..", "tmp", "test_output")
end

# TODO change puts/print to use a single method for logging, which will then make the stubbing cleaner
def stub_puts_and_print(obj)
  obj.stubs(:puts)
  obj.stubs(:print)
end

def make_link(link, crawler=Relevance::Tarantula::Crawler.new, referrer=nil)
  Relevance::Tarantula::Link.new(link, crawler, referrer)
end

def make_form(form, crawler=Relevance::Tarantula::Crawler.new, referrer=nil)
  Relevance::Tarantula::Form.new(form, crawler, referrer)
end

def not_in_editor?
  ['TM_MODE', 'EMACS', 'VIM'].all? { |k| !ENV.has_key?(k) }
end

RSpec.configure do |c|
  c.alias_example_to :fit, :focused => true
  c.alias_example_to :xit, :disabled => true
  c.mock_with :mocha
  c.color_enabled = not_in_editor?
  c.filter_run :focused => true
  c.run_all_when_everything_filtered = true
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
codez-tarantula-0.5.5 spec/spec_helper.rb
codez-tarantula-0.5.4 spec/spec_helper.rb
codez-tarantula-0.5.3 spec/spec_helper.rb