spec_helper.rb revision fd6a3bcee7d7a9d2261818557ce4760e1c13ced8
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync# This file is copied to spec/ when you run 'rails generate rspec:install'
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncENV["RAILS_ENV"] ||= 'test'
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncrequire File.expand_path("../../test/shared_helper", __FILE__)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncinclude SharedHelper
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncuse_simplecov
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncrequire File.expand_path("../../config/environment", __FILE__)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncrequire 'rspec/rails'
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncrequire 'rspec/autorun'
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncrequire Rails.root.join('config', 'database_cleaner.rb')
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync# Requires supporting ruby files with custom matchers and macros, etc,
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync# in spec/support/ and its subdirectories.
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncDir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncclass ActionController::TestRequest
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync attr_writer :query_string
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync def query_string
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync @query_string.to_s
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync end
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncend
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncdef fixture_file(name)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync Rails.root + 'test/fixtures/ontologies/xml/' + name
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncend
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncdef add_fixture_file(repository, relative_file)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync path = File.join(Rails.root, 'test', 'fixtures', 'ontologies', relative_file)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync version_for_file(repository, path)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncend
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsyncdef version_for_file(repository, path)
a734c64bff58bda2fa48c2795453e092167b0ff7vboxsync dummy_user = FactoryGirl.create :user
basename = File.basename(path)
version = repository.save_file path, basename, "#{basename} added", dummy_user
end
# includes the convenience-method `define_ontology('name')`
include OntologyUnited::Convenience
def parse_this(user, ontology, xml_path, code_path)
evaluator = Hets::Evaluator.new(user, ontology,
path: xml_path,
code_path: code_path)
evaluator.import
end
RSpec.configure do |config|
# ## Mock Framework
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.before(:each) do
redis = WrappingRedis::RedisWrapper.new
redis.del redis.keys.join(' ')
end
config.after(:each) do
end
config.expose_current_running_example_as :example
config.infer_spec_type_from_file_location!
config.infer_base_class_for_anonymous_controllers = true
config.include Devise::TestHelpers, type: :controller
config.treat_symbols_as_metadata_keys_with_true_values = true
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end