Sha256: 60708c1d99452fbf133ecc6e7f33ad6be9b596cdeba0b2e64999779ba332c38f

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 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(rspec: true)
  end
  after { FileUtils.rm_r(destination) }

  describe Howitzer::RspecGenerator do
    let(:generator_name) { described_class }
    let(:expected_result) do
      [
        { name: '/spec', is_directory: true },
        { name: '/spec/example_spec.rb', is_directory: false, size: template_file_size('rspec', 'example_spec.rb') },
        { name: '/spec/spec_helper.rb', is_directory: false, size: template_file_size('rspec', 'spec_helper.rb') },
        { name: '/tasks', is_directory: true },
        { name: '/tasks/rspec.rake', is_directory: false, size: template_file_size('rspec', 'rspec.rake') }
      ]
    end
    it { is_expected.to eql(expected_result) }
    describe 'output' do
      let(:expected_output) do
        "#{ColorizedString.new('  * RSpec integration to the framework ...').light_cyan}
      #{ColorizedString.new('Added').light_green} 'spec/spec_helper.rb' file
      #{ColorizedString.new('Added').light_green} 'spec/example_spec.rb' file
      #{ColorizedString.new('Added').light_green} 'tasks/rspec.rake' 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/rspec_generator_spec.rb
howitzer-2.1.1 spec/unit/generators/rspec_generator_spec.rb
howitzer-2.1.0 spec/unit/generators/rspec_generator_spec.rb