Sha256: 96f9abc09b317e4ad909c2d2eeffb8699038ad392f784f12dd5cf9b6f58fe139

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require "spec_helper"

class GircMock
  attr_accessor :current_branch
  def in_git_dir?; true end
end

describe Cbt::App do

  describe "#initialize" do
    subject(:app) do
      Cbt::App.new(config_file: "examples/config/components.yml")
    end

    it "parses two components in the list" do
      app.components.keys.size.should eq(3)
      app.components.each { |k,v| v.is_a?(Cbt::Component).should be_true }
    end

    it "parses module files for component utils" do
      app.components["utils"].modules.size.should eq(2)
      app.components["utils"].modules.each {|k,v| v.is_a?(Cbt::LuaModule).should be_true}
    end
  end

  describe "#current_component_names" do
    subject(:app) do
      app = Cbt::App.new(config_file: "examples/config/components.yml")
      app.git = GircMock.new
      app
    end

    it "return component for full format current branch" do
      app.git.current_branch = 'component/utils'
      app.current_component_names[0].should eq('utils')
    end

    it "return component for shorter format current branch" do
      app.git.current_branch = 'comp/utils'
      app.current_component_names[0].should eq('utils')
    end

    it "return component for short format current branch" do
      app.git.current_branch = 'ct/utils'
      app.current_component_names[0].should eq('utils')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cbt-0.0.1 spec/app_spec.rb