Sha256: 332532285a416e971b81ff92dc9749408095b17b73cc7ffa96002a5a8f04cce6

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

RSpec.describe 'Generators' do
  let(:destination) { Howitzer::BaseGenerator.destination }
  let(:output) { StringIO.new }
  subject { file_tree_info(destination) }
  before do
    Howitzer::BaseGenerator.logger = output
    generator_name.new
  end
  after { FileUtils.rm_r(destination) }

  describe 'RootGenerator' do
    let(:generator_name) { Howitzer::RootGenerator }
    let(:expected_result) do
      [
          {:name=> '/Gemfile', :is_directory=>false, :size=>template_file_size('root', 'Gemfile')},
          {:name=> '/Rakefile', :is_directory=>false, :size=>template_file_size('root', 'Rakefile')},
          {:name=> '/boot.rb', :is_directory=>false, :size=>template_file_size('root', 'boot.rb')}
      ]
    end
    it { is_expected.to eql(expected_result) }
    describe 'output' do
      let(:expected_output) do
        "  * Root files generation ...
      Added '.gitignore' file
      Added 'Gemfile' file
      Added 'Rakefile' file
      Added 'boot.rb' file\n"
      end
      subject { output.string }
      it { is_expected.to eql(expected_output) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
howitzer-1.1.1 spec/unit/generators/root_generator_spec.rb
howitzer-1.1.0 spec/unit/generators/root_generator_spec.rb