Sha256: 3ba8406bfd485b9757408a29ec4a0ec0cdece882249809ce89d702852ebfef92

Contents?: true

Size: 1.98 KB

Versions: 9

Compression:

Stored size: 1.98 KB

Contents

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'

require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
require 'capybara/rails'

require File.expand_path('../support/features', __FILE__)

if ENV['COVERAGE']
  require 'simplecov'
  SimpleCov.start 'rails'
  SimpleCov.command_name "spec"
end

$in_travis = !ENV['TRAVIS'].nil? && ENV['TRAVIS'] == 'true'

if $in_travis
  # Monkey-patches the FITS runner to return the PDF FITS fixture
  module Hydra 
    module Derivatives
      module ExtractMetadata
        def run_fits!(path)
          File.open(File.join(File.expand_path('../fixtures', __FILE__), 'pdf_fits.xml')).read
        end
      end
    end
  end
end

Resque.inline = Rails.env.test?

FactoryGirl.definition_file_paths = [File.expand_path("../factories", __FILE__)]
FactoryGirl.find_definitions

module EngineRoutes
  def self.included(base)
    base.routes { Sufia::Engine.routes }
  end
end

RSpec.configure do |config|
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = File.expand_path("../fixtures", __FILE__)

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = true

  # If true, the base class of anonymous controllers will be inferred
  # automatically. This will be the default behavior in future versions of
  # rspec-rails.
  config.infer_base_class_for_anonymous_controllers = false

  config.include Devise::TestHelpers, :type => :controller
  config.include EngineRoutes, :type => :controller
end


module FactoryGirl
  def self.find_or_create(handle, by=:email)
    tmpl = FactoryGirl.build(handle)
    tmpl.class.send("find_by_#{by}".to_sym, tmpl.send(by)) || FactoryGirl.create(handle)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sufia-3.3.1 spec/spec_helper.rb
sufia-3.4.0.rc2 spec/spec_helper.rb
sufia-3.4.0.rc1 spec/spec_helper.rb
sufia-3.3.0 spec/spec_helper.rb
sufia-3.2.1 spec/spec_helper.rb
sufia-3.1.3 spec/spec_helper.rb
sufia-3.1.2 spec/spec_helper.rb
sufia-3.1.1 spec/spec_helper.rb
sufia-3.1.0 spec/spec_helper.rb