Sha256: 48abdbdcf31cc8632a75e653d3f9d92d9cb9a2fd94b958ee23a2b28f57b145ae

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe YARD::CodeObjects::MethodObject do
  before do 
    Registry.clear 
    @yard = ModuleObject.new(:root, :YARD)
  end
  
  it "should have a path of testing for an instance method in the root" do
    meth = MethodObject.new(:root, :testing)
    meth.path.should == "#testing"
  end
  
  it "should have a path of YARD#testing for an instance method in YARD" do
    meth = MethodObject.new(@yard, :testing)
    meth.path.should == "YARD#testing"
  end
  
  it "should have a path of YARD::testing for a class method in YARD" do
    meth = MethodObject.new(@yard, :testing, :class)
    meth.path.should == "YARD::testing"
  end
  
  it "should exist in the registry after successful creation" do
    obj = MethodObject.new(@yard, :something, :class)
    Registry.at("YARD::something").should_not == nil
    obj = MethodObject.new(@yard, :somethingelse)
    Registry.at("YARD#somethingelse").should_not == nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yard-0.2.2 spec/code_objects/method_object_spec.rb