From 4e291f5348aca4aef9ca9df27152cfd705463995 Mon Sep 17 00:00:00 2001 From: David Crosby Date: Sun, 22 May 2022 22:20:38 -0600 Subject: [PATCH] Get users-guide tests running And with this commit, no more errors. Next up is dealing with the remaining failures --- test/data/users-guide/example_address_book.rb | 5 +++-- test/data/users-guide/loadbabel.rb | 2 +- test/test-users-guide.rb | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/data/users-guide/example_address_book.rb b/test/data/users-guide/example_address_book.rb index ba8016a..7f0cd87 100644 --- a/test/data/users-guide/example_address_book.rb +++ b/test/data/users-guide/example_address_book.rb @@ -1,9 +1,10 @@ -require 'address_book' +require_relative 'address_book' require 'yaml' require 'pp' +require 'date' str = File.read('address_book.yaml') -ydoc = YAML.load(str) +ydoc = YAML.load(str, permitted_classes: [Date]) addrbook = AddressBook.new(ydoc) pp addrbook.groups diff --git a/test/data/users-guide/loadbabel.rb b/test/data/users-guide/loadbabel.rb index 3d38ad4..ef91e12 100644 --- a/test/data/users-guide/loadbabel.rb +++ b/test/data/users-guide/loadbabel.rb @@ -1,5 +1,5 @@ require 'kwalify' -require 'models' +require_relative 'models' ## load schema definition schema = Kwalify::Yaml.load_file('BABEL.schema.yaml', diff --git a/test/test-users-guide.rb b/test/test-users-guide.rb index e256149..7da5948 100644 --- a/test/test-users-guide.rb +++ b/test/test-users-guide.rb @@ -2,8 +2,9 @@ class UsersGuideTest < Test::Unit::TestCase - DATA_DIR = 'data/users-guide' + DATA_DIR = 'test/data/users-guide' CURR_DIR = Dir.pwd + puts "CURR DIR is #{CURR_DIR}" for item in Dir.glob("#{DATA_DIR}/*.result").sort() filename = File.basename(item) name = (filename =~ /(.*)\.\w+$/) && $1.gsub(/[^\w]/, '_')