Sha256: e8a19ec08150f14b86f0ba38793e4853edd50372fe50a6f241ccb20ea67c7b0f

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 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 'RSpecGenerator' do
    let(:generator_name) { Howitzer::RspecGenerator }
    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
        "  * RSpec integration to the framework ...
      Added 'spec/spec_helper.rb' file
      Added 'spec/example_spec.rb' file
      Added 'tasks/rspec.rake' 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/rspec_generator_spec.rb
howitzer-1.1.0 spec/unit/generators/rspec_generator_spec.rb