Sha256: 4ce49eee6ab629bbd902040c222f88ffd91fede1f5fb1ea739ea9345526e03fb

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require_relative '../helper'
require 'author/commands/generator'

describe Author::Commands::Generator do
  
  it "should require a name" do
    output = capture(:stderr) { Author::Commands::Generator.start }
    expect(output).to_include "No value provided for required arguments 'name'"
  end
  
  it "should create project structure" do
    play_in_sandbox do
      capture(:stdout) { Author::Commands::Generator.start ['abook'] }
      
      'abook'.must_be_a_directory
      'abook/chapters'.must_be_a_directory
      'abook/export'.must_be_a_directory
      'abook/templates'.must_be_a_directory
    end
  end
  
  it "should create project files" do
    play_in_sandbox do
      capture { Author::Commands::Generator.start ['ihazfiles']}
      
      'ihazfiles/config.yml'.must_be_a_file
      'ihazfiles/Gemfile'.must_be_a_file
      'ihazfiles/outline.txt'.must_be_a_file
      'ihazfiles/chapters/sample.md'.must_be_a_file
      'ihazfiles/templates/layout.xhtml'.must_be_a_file
      'ihazfiles/export/book.css'.must_be_a_file
    end
  end
  
  it "should run bundler for the new project" do
    play_in_sandbox do
      output = capture(:stdout) { Author::Commands::Generator.start ['bundled'] }
      expect(output).to_include "Bundling gems"
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
author-1.1.4.alpha test/commands/generator_test.rb
author-1.1.3.alpha test/commands/generator_test.rb
author-1.1.2.alpha test/commands/generator_test.rb
author-1.1.1.alpha test/commands/generator_test.rb