Sha256: 5e25ec086607c271af37325d8efec8d826aaf738bf69cf70640a3dfccdad777d

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

# ------------------------------------------------------------
# Simplecov

if ENV['COVERAGE']
  require 'colorize'
  require 'simplecov'
end

# ------------------------------------------------------------
# RSpec

require 'webmock/rspec'

RSpec.configure do |config|
  config.color = true
  config.tty = true
  config.formatter = :documentation
  config.before(:each) { WebMock.disable_net_connect!(allow_localhost: true) }
  config.after(:each) { WebMock.allow_net_connect! }
  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end
  config.shared_context_metadata_behavior = :apply_to_host_groups
end

# ------------------------------------------------------------
# Code under test

require 'berkeley_library/alma'

# ------------------------------------------------------------
# Utility methods

def sru_url_for(index, value)
  "https://berkeley.alma.exlibrisgroup.com/view/sru/01UCS_BER?version=1.2&operation=searchRetrieve&query=#{index}%3D#{value}"
end

def sru_data_path_for(record_id)
  "spec/data/#{record_id}-sru.xml"
end

def stub_sru_request(index, value)
  sru_url_ = sru_url_for(index, value)
  marc_xml_path = sru_data_path_for(value)

  stub_request(:get, sru_url_).to_return(status: 200, body: File.read(marc_xml_path))
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
berkeley_library-alma-0.0.6 spec/spec_helper.rb
berkeley_library-alma-0.0.5 spec/spec_helper.rb
berkeley_library-alma-0.0.4 spec/spec_helper.rb