Sha256: 16c50a0a50d5b94498f8013a9db77d5f88145ff45071d5ff82ad7d7b4f53b10f

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require File.join(File.dirname(__FILE__),'..','spec_helper')

describe Scaffolder::ToolIndex do

  before(:each) do
    @help_tool = Scaffolder::Tool::Help

    @tool_class = Class.new(Scaffolder::Tool)
    @tool_name = 'type'
    Scaffolder::Tool.const_set(@tool_name.capitalize,@tool_class)

    @args = OpenStruct.new({ :rest => %W|#{@tool_name} arg1 arg2| })
  end

  after(:each) do
    Scaffolder::Tool.send(:remove_const,'Type')
  end

  subject do
    object = Object.new
    object.extend described_class
    object
  end

  describe "tool_exists? method" do

    it "should return false when no such tool exists" do
      subject.tool_exists?('unknown-tool').should be_false
    end

    it "should return true when the tool exists" do
      subject.tool_exists?(@tool_name).should be_true
    end

  end

  describe "get_tool method" do

    it "should return nil when no such tool exists" do
      subject.get_tool('unknown-tool').should be_nil
    end

    it "should return the tool class when the tool exists" do
      subject.get_tool(@tool_name).should == @tool_class
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scaffolder-tools-0.1.2 spec/scaffolder/tool_index_spec.rb
scaffolder-tools-0.1.1 spec/scaffolder/tool_index_spec.rb
scaffolder-tools-0.1.0 spec/scaffolder/tool_index_spec.rb