require 'rails_helper'
require 'generator_spec'

require 'generators/dunlop/install/source_files/source_files_generator'
describe Dunlop::Install::SourceFilesGenerator, type: :generator, broken: true do
  #destination File.expand_path("../../tmp", __FILE__)
  destination Rails.root.join('tmp')
  #arguments %w[ my_source_file ]

  before :all do
    prepare_destination
    destination = Rails.root.join('tmp')
    FileUtils.cp_r(Rails.root.join('config'), destination)
    FileUtils.touch destination.join('Gemfile')
    run_generator
  end

  specify do
    expect( destination_root ).to have_structure {
      directory "config" do
        file "application.rb" do
          contains "config.file_storage_path = Rails.root.join('files')"
          contains "config.working_path = '/tmp'"
        end

        file "locales/source_files.yml"
      end
    }
  end
end
