Sha256: 700869c162305b1d1155a76db465aac8691fe409b764fa5d53c5a98083171ad6

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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 'ConfigGenerator' do
    let(:generator_name) { Howitzer::ConfigGenerator }
    let(:expected_result) do
      [
          {:name=> '/config', :is_directory=>true},
          {:name=> '/config/custom.yml', :is_directory=>false, :size=>template_file_size('config', 'custom.yml')},
          {:name=> '/config/default.yml', :is_directory=>false, :size=>template_file_size('config', 'default.yml')}
      ]
    end

    it { is_expected.to eql(expected_result) }
    describe 'output' do
      let(:expected_output) do
        "  * Config files generation ...
      Added 'config/custom.yml' file
      Added 'config/default.yml' 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/config_generator_spec.rb
howitzer-1.1.0 spec/unit/generators/config_generator_spec.rb