Sha256: 3dda2ac3264ab6940ea86688c84f66e22193f0c635dbc7f1a0d2ae5b4ee7316c

Contents?: true

Size: 946 Bytes

Versions: 2

Compression:

Stored size: 946 Bytes

Contents

require 'spec_helper'
require 'napa/generators/readme_generator'
require 'napa/cli'

describe Napa::Generators::ReadmeGenerator do
  let(:test_readme_directory) { 'spec/tmp' }

  before do
    allow_any_instance_of(described_class).to receive(:output_directory).and_return(test_readme_directory)
    Napa::CLI::Base.new.generate("readme")
  end

  after do
    FileUtils.rm_rf(test_readme_directory)
  end

  describe 'README' do
    it 'creates a README in the current directory' do
      expected_readme_file = File.join(test_readme_directory, 'README.md')
      readme = File.read(expected_readme_file)

      expect(readme).to match /# #{Napa::Identity.name}/
    end
  end

  describe 'spec' do
    it 'creates a README spec' do
      expected_spec_file = File.join(test_readme_directory, 'spec/docs/readme_spec.rb')
      spec_code = File.read(expected_spec_file)

      expect(spec_code).to match(/describe \'README\'/)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
napa-0.4.1 spec/generators/readme_generator_spec.rb
napa-0.4.0 spec/generators/readme_generator_spec.rb