Sha256: 65a51333157acf42fb1a5f96df2aee30442c395ecf4c22c762ac0e89acc5c697

Contents?: true

Size: 1.49 KB

Versions: 28

Compression:

Stored size: 1.49 KB

Contents

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

describe YARD::Templates::Helpers::TextHelper do
  include YARD::Templates::Helpers::TextHelper
  include YARD::Templates::Helpers::MethodHelper
  
  describe '#signature' do
    before do
      @results = {
        :regular => "root.foo -> Object",
        :default_return => "root.foo -> Hello",
        :no_default_return => "root.foo",
        :private_class => "A.foo -> Object (private)",
        :single => "root.foo -> String",
        :two_types => "root.foo -> (String, Symbol)",
        :two_types_multitag => "root.foo -> (String, Symbol)",
        :type_nil => "root.foo -> Type?",
        :type_array => "root.foo -> Type+",
        :multitype => "root.foo -> (Type, ...)",
        :void => "root.foo -> void",
        :hide_void => "root.foo",
        :block => "root.foo {|a, b, c| ... } -> Object",
        :empty_overload => 'root.foobar -> String'
      }
    end
    
    def signature(obj) super(obj).strip end
    
    it_should_behave_like "signature"
  end

  describe '#align_right' do
    it "should align text right" do
      text = "Method: #some_method (SomeClass)"
      align_right(text).should == ' ' * 40 + text
    end

    it "should truncate text that is longer than allowed width" do
      text = "(Defined in: /home/user/.rip/.packages/some_gem-2460672e333ac07b9190ade88ec9a91c/long/path.rb)"
      align_right(text).should == ' ' + text[0,68] + '...'
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.6.1 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.6.0 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.5.4 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.5.3 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.5.2 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.5.1 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.5.0 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.4.1 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.4.0 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.3.5 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.3.4 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.3.3 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.3.2 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.3.1 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.3.0 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.2.1 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
challah-0.2.0 vendor/bundle/gems/yard-0.7.5/spec/templates/helpers/text_helper_spec.rb
yard-0.7.5 spec/templates/helpers/text_helper_spec.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/yard-0.7.4/spec/templates/helpers/text_helper_spec.rb