require 'rails_helper'
require 'generator_spec'

require 'generators/dunlop/install/workflow/workflow_generator'
describe Dunlop::Install::WorkflowGenerator, type: :generator, broken: true do
  #destination File.expand_path("../../tmp", __FILE__)
  destination Rails.root.join('tmp')
  #arguments %w(something)

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

  specify do
    expect( destination_root ).to have_structure {
      directory "app" do
        directory "models" do
          file "workflow_instance.rb" do
            contains "include Dunlop::WorkflowInstanceModel"
          end

          directory "workflow_instance" do
            file "data_setup.rb"
          end
        end
      end
    }
  end
end
