Sha256: 84ccb8f48cf0aa7e8f81ef5ee83da0062550d466a6e049d15230dd4995dabd8c

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'spec/spec_helper'

describe Another do
  it "runs" do
    mock(Another::Runner).new(['one-more'])
    Another.run(['one-more'])
  end
  
  describe Another::Runner do
    attr_reader :runner
    
    before(:each) do
      @runner = Another::Runner.new(['one-more'])
    end
    
    it "gets project_name" do
      runner.project_name.should == 'one-more'
    end
    
    it "gets module name" do
      runner.module_name.should == 'OneMore'
    end
    
    it "get target_directory" do
      stub(Dir).pwd { '/User/foo' }
      runner.target_directory.should == '/User/foo/one-more'
    end
    
    describe "confirmation" do
      context "when yes" do
        it "is confirmed" do
          stub($stdin).gets { "y" }
          runner.should be_confirmed
        end
      end
      
      context "when no" do
        it "is not confirmed" do
          stub($stdin).gets { "n" }
          runner.should_not be_confirmed
        end
      end
      
      context "when blank" do
        it "it is not confirmed" do
          stub($stdin).gets { '' }
          runner.should_not be_confirmed
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
nakajima-another-0.0.2 spec/another_spec.rb
another-0.0.3 ./spec/another_spec.rb