Sha256: dd0d7f9931d62362135e21e6d95615522bf44e4fa97c87debb72b6a6482b7a25

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'
require 'gitscrub/cli'

describe Gitscrub::CLI do
  
  before(:each) do
    game = mock.as_null_object
    @cli = Gitscrub::CLI.new
    Gitscrub::Game.stub(:new).and_return(game)
  end

  it "should print the logo" do
    Gitscrub::UI.should_receive(:word_box).with("Gitscrub")
    @cli.stub(:make_directory) 
    @cli.setup
  end

  it "should create a directory if one does not exist" do
    Gitscrub::UI.stub(:ask).and_return(true) 
    Dir.should_receive(:mkdir).with("./git_scrub")
    Dir.should_receive(:chdir).with("git_scrub")
    @cli.make_directory
  end

  it "should not make a directory if you are in the game directory" do
    Dir.stub(:pwd).and_return("/home/git_scrub")
    Gitscrub::UI.should_not_receive(:ask)
    @cli.make_directory 
  end

  it "should create a directory if one does not exist" do
    Gitscrub::UI.stub(:ask).and_return(false) 
    lambda {@cli.make_directory}.should raise_error(SystemExit)
  end

  it "should check the current solution" do
    @cli.check.should eql(true) 
  end

  it "should reset the current level" do
    @cli.check.should eql(true) 
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitscrub-0.0.3 spec/gitscrub/cli_spec.rb