Sha256: 6b7fe1ac8d8ccf311b678e145e5116e8ba546e14c66c12c89f6a947284142a92
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
# encoding: utf-8 require File.dirname(__FILE__) + "/../spec_helper" require "kitabu/command" OUTPUT = [] module Kitabu module Command extend self def output(*args) args.each {|v| OUTPUT << v} end end end describe "Kitabu::Command" do before(:each) do @dir = "/tmp/kitabu-sample" OUTPUT.delete_if { true } ARGV.delete_if { true } FileUtils.rm_rf(@dir) end it "should copy templates" do run_with(@dir) File.should be_file(@dir + "/Rakefile") File.should be_file(@dir + "/config.yml") File.should be_file(@dir + "/templates/layout.css") File.should be_file(@dir + "/templates/layout.html") File.should be_file(@dir + "/templates/syntax.css") File.should be_file(@dir + "/templates/user.css") File.should be_directory(@dir + "/text") File.should be_directory(@dir + "/output") end it "should display help when no arg is provided" do doing { run_with }.should exit_with(0) OUTPUT.first.should == KITABU_HELP end it "should require valid layout" do doing { run_with @dir, "-l", "invalid" }.should exit_with(1) OUTPUT.first.should == "Invalid layout" end it "should accept valid layout" do run_with @dir, "-l", "boom" File.should be_file(@dir + "/templates/layout.css") File.should be_file(@dir + "/templates/layout.html") end it "should exit on existing path" do run_with @dir doing { run_with @dir }.should exit_with(1) OUTPUT.first.should == "Output path already exists" end private def argv!(*args) args.each {|v| ARGV << v } end def run_with(*args) argv!(*args) Kitabu::Command.run! end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kitabu-0.4.7 | spec/kitabu/command_spec.rb |
kitabu-0.4.6 | spec/kitabu/command_spec.rb |
kitabu-0.4.5 | spec/kitabu/command_spec.rb |