Sha256: a2433e2d39a212f191af0b74a8818dedba8587bbc68ee448e2951a3cfdd996b2

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 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 Howitzer::WebGenerator do
    let(:generator_name) { described_class }
    let(:expected_result) do
      [
        {
          name: '/web',
          is_directory: true
        },
        {
          name: '/web/pages',
          is_directory: true
        },
        {
          name: '/web/pages/example_page.rb',
          is_directory: false,
          size: template_file_size('web', 'example_page.rb')
        },
        {
          name: '/web/sections',
          is_directory: true
        },
        {
          name: '/web/sections/menu_section.rb',
          is_directory: false,
          size: template_file_size('web', 'menu_section.rb')
        }
      ]
    end
    it { is_expected.to eql(expected_result) }
    describe 'output' do
      let(:expected_output) do
        "#{ColorizedString.new('  * PageOriented pattern structure generation ...').light_cyan}
      #{ColorizedString.new('Added').light_green} 'web/pages/example_page.rb' file
      #{ColorizedString.new('Added').light_green} 'web/sections/menu_section.rb' file\n"
      end
      subject { output.string }
      it { is_expected.to eql(expected_output) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
howitzer-2.2.0 spec/unit/generators/web_generator_spec.rb
howitzer-2.1.1 spec/unit/generators/web_generator_spec.rb
howitzer-2.1.0 spec/unit/generators/web_generator_spec.rb