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