Sha256: 98e055c6bc6e9468883470b3072a2dd5ff67f463bdcc76f0478f3762792e016a
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
# -*- coding: utf-8 -*- require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) describe CommandBuild do before do @dir1_dirname = File.join(TEST_DIR, "dir1") @dir2_dirname = File.join(TEST_DIR, "dir2") @certified_output_dirname = File.join(TEST_DIR, "certified_output") @tmp_output_dirname = File.join(TEST_DIR, "tmp") end it "should accept -h (-help) option" do out = with_stdout_captured do args = %w{build -h} CliDirCat.new.parse_and_execute(args) end out.should match /Usage:/ end it "should not accept more then -o options" do out = with_stdout_captured do args = "build -f -o filename -o filename1" CliDirCat.new.parse_and_execute(args.split) end out.should match /only one file/ end it "should build a catalog from a directory" do expect_filename = File.join(@certified_output_dirname, "dircat1.yaml") result_filename = File.join(@tmp_output_dirname, "dircat1.yaml") out = with_stdout_captured do args = "build -f -o #{result_filename} #{@dir1_dirname}" CliDirCat.new.parse_and_execute(args.split) end cat_expect = Cat.from_file(expect_filename) cat_result = Cat.from_file(result_filename) (cat_result - cat_result).size.should == 0 (cat_result - cat_expect).size.should == 0 (cat_expect - cat_result).size.should == 0 FileUtils.rm(result_filename) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dircat-0.1.7 | spec/dircat/cli/command_build_spec.rb |
dircat-0.1.6 | spec/dircat/cli/command_build_spec.rb |