test/test_helper.rb in exlibris-aleph-0.1.6 vs test/test_helper.rb in exlibris-aleph-1.0.0
- old
+ new
@@ -1,42 +1,46 @@
-# Configure Rails Environment
-ENV["RAILS_ENV"] = "test"
+require 'coveralls'
+Coveralls.wear!
+require 'test/unit'
+require File.expand_path("../../lib/exlibris-aleph.rb", __FILE__)
-require File.expand_path("../dummy/config/environment.rb", __FILE__)
-require "rails/test_help"
-
-Rails.backtrace_cleaner.remove_silencers!
-
# VCR is used to 'record' HTTP interactions with
# third party services used in tests, and play em
# back. Useful for efficiency, also useful for
# testing code against API's that not everyone
# has access to -- the responses can be cached
# and re-used.
require 'vcr'
require 'webmock'
-# To allow us to do real HTTP requests in a VCR.turned_off, we
-# have to tell webmock to let us.
-WebMock.allow_net_connect!(:net_http_connect_on_start => true)
-
-without_ctx_tim = VCR.request_matchers.uri_without_param(:ctx_tim)
VCR.configure do |c|
c.cassette_library_dir = 'test/vcr_cassettes'
# webmock needed for HTTPClient testing
c.hook_into :webmock
- c.register_request_matcher(:uri_without_ctx_tim, &without_ctx_tim)
# c.debug_logger = $stderr
- c.filter_sensitive_data('VERIFICATION') { 'd4465aacaa645f2164908cd4184c09f0' }
+ c.filter_sensitive_data("library.edu") { "library.nyu.edu" }
end
-# Silly way to not have to rewrite all our tests if we
-# temporarily disable VCR, make VCR.use_cassette a no-op
-# instead of no-such-method.
-if ! defined? VCR
- module VCR
- def self.use_cassette(*args)
- yield
+class Test::Unit::TestCase
+
+ def yaml_aleph_configuration
+ Exlibris::Aleph.configure do |config|
+ config.load_yaml File.expand_path("../support/config.yml", __FILE__)
end
end
-end
+ protected :yaml_aleph_configuration
+ def reset_aleph_configuration
+ Exlibris::Aleph.configure do |config|
+ config.base_url = nil
+ config.rest_url = nil
+ config.adms = nil
+ config.refresh_time = nil
+ config.tab_path = nil
+ config.yml_path = nil
+ config.logger = nil
+ config.irrelevant_sub_libraries = nil
+ config.load_time = nil
+ end
+ end
+ protected :reset_aleph_configuration
+end
\ No newline at end of file