Sha256: 26d343e4420a0af7d669ad5d62d12933b53e82c55f1e9dae364c05a21c73deaa

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require '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

1 entries across 1 versions & 1 rubygems

Version Path
scaffolder-tools-0.1.3 spec/scaffolder/tool_index_spec.rb