Sha256: ae38284525c296cebe63bb918d47d5c50e91b2094496e6ff8a1b70fc1b497ce1

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

# :nodoc
require "hydra-pbcore"
require "equivalent-xml"
require "pry"

RSpec.configure do |config|
  config.color = true
end

# Returns a file from spec/fixtures
def fixture(file)
  File.new(File.join(File.dirname(__FILE__), 'fixtures', file))
end

# Returns a file from spec/fixtures/deprecated
def deprecated_fixture(file)
  File.new(File.join(File.dirname(__FILE__), 'fixtures', 'deprecated', file))
end

# Returns a file from tmp
def sample(file)
  File.new(File.join('tmp', file))
end

# Returns a Nokogiri::XML object from spec/fixtures/integration
def integration_fixture(file)
  Nokogiri::XML(File.new(File.join(File.dirname(__FILE__), 'fixtures', 'integration', file))) 
end

# Saves a sample template to tmp
def save_template input, filename
  out = File.new(File.join("tmp", filename), "w")
  out.write(input.to_s)
  out.close
end

# Tests if a file in spec/fixtures is the same as the file in tmp
def tmp_file_should_match_exemplar(file)
  f = Nokogiri::XML(fixture(file))
  s = Nokogiri::XML(sample(file))
  f.should be_equivalent_to s
end

def random_string
  (0...50).map{ ('a'..'z').to_a[rand(26)] }.join
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hydra-pbcore-3.3.1 spec/spec_helper.rb
hydra-pbcore-3.3.0 spec/spec_helper.rb
hydra-pbcore-3.2.0 spec/spec_helper.rb
hydra-pbcore-3.1.0 spec/spec_helper.rb
hydra-pbcore-3.0.2 spec/spec_helper.rb
hydra-pbcore-3.0.1 spec/spec_helper.rb
hydra-pbcore-3.0.0 spec/spec_helper.rb
hydra-pbcore-3.0.0.rc1 spec/spec_helper.rb