From 7ae828e182ad6a1ced2580773c8413308eb804de Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Tue, 22 Oct 2019 19:45:19 +0200 Subject: [PATCH] Made crystal spec tests run the code --- spec/andrew_spec.cr | 9 +++++---- src/andrew.cr | 8 ++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/andrew_spec.cr b/spec/andrew_spec.cr index acc9680..196eaef 100644 --- a/spec/andrew_spec.cr +++ b/spec/andrew_spec.cr @@ -1,9 +1,10 @@ require "./spec_helper" describe Andrew do - # TODO: Write tests - - it "works" do - false.should eq(true) + it "generate record.yml" do + File.open("tests/record.yml") do |file| + fg = FileGenerator.from_yaml(file) + end + true.should eq(true) end end diff --git a/src/andrew.cr b/src/andrew.cr index bd2d0a0..b145089 100644 --- a/src/andrew.cr +++ b/src/andrew.cr @@ -128,6 +128,10 @@ class AttributeAfterGenerator end end -File.open(ARGV[0]) do |file| - puts FileGenerator.from_yaml(file).to_s +if(ARGV.size != 0) + File.open(ARGV[0]) do |file| + puts FileGenerator.from_yaml(file).to_s + end +else + puts "Andrew code generator\n\tExpects a single YAML file as argument" end