Sha256: 2be89117f9635cd8d69bb1cef0baf47e199d2da4c90851b1a1c7aa3e74bb4f01

Contents?: true

Size: 837 Bytes

Versions: 10

Compression:

Stored size: 837 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.exists?("./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

10 entries across 10 versions & 1 rubygems

Version Path
ruboty-1.1.4 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.3 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.2 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.1 spec/ruboty/commands/generate_spec.rb
ruboty-1.1.0 spec/ruboty/commands/generate_spec.rb
ruboty-1.0.4 spec/ruboty/commands/generate_spec.rb
ruboty-1.0.3 spec/ruboty/commands/generate_spec.rb
ruboty-1.0.2 spec/ruboty/commands/generate_spec.rb
ruboty-1.0.1 spec/ruboty/commands/generate_spec.rb
ruboty-1.0.0 spec/ruboty/commands/generate_spec.rb