Sha256: 52be09342deed6996ad9e9badac74979c736588af5645061ce06316ba1889934

Contents?: true

Size: 836 Bytes

Versions: 8

Compression:

Stored size: 836 Bytes

Contents

require "spec_helper"

describe Ruboty::Commands::Generate do
  describe "#call" do
    after do
      FileUtils.rmtree("./ruboty/")
    end

    let(:command) do
      Ruboty::CommandBuilder.new(arguments).build
    end

    let(:call) do
      command.call
    end

    let(:arguments) do
      ["--generate"]
    end

    context "with normal condition" do
      it "generates ./ruboty/ directory from our templates" do
        call
        File.exist?("./ruboty/").should == true
      end
    end

    context "when ./ruboty/ directory already exists" do
      before do
        FileUtils.mkdir("./ruboty/")
      end

      it "exits process with dying message" do
        Ruboty.logger.should_receive(:error).with("Error: ./ruboty/ already exists.")
        expect { call }.to raise_error(SystemExit)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruboty-1.2.2 spec/ruboty/commands/generate_spec.rb
ruboty-1.2.1 spec/ruboty/commands/generate_spec.rb
ruboty-1.2.0 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.9 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.8 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.7 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.6 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.5 spec/ruboty/commands/generate_spec.rb