Sha256: cefa7fc24644a0d4f3be910d3027b34a562e7ec396f9479cecd125e402f7a2f9

Contents?: true

Size: 1.48 KB

Versions: 68

Compression:

Stored size: 1.48 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

68 entries across 52 versions & 7 rubygems

Version Path
yard-0.8.7.6 spec/templates/helpers/text_helper_spec.rb
yard-0.8.7.5 spec/templates/helpers/text_helper_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
yard-0.8.7.4 spec/templates/helpers/text_helper_spec.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/templates/helpers/text_helper_spec.rb
yard-0.8.7.3 spec/templates/helpers/text_helper_spec.rb
yard-0.8.7.2 spec/templates/helpers/text_helper_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/yard-0.8.7/spec/templates/helpers/text_helper_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/yard-0.8.7/spec/templates/helpers/text_helper_spec.rb
candlepin-api-0.4.0 bundle/ruby/gems/yard-0.8.7/spec/templates/helpers/text_helper_spec.rb
yard-0.8.7.1 spec/templates/helpers/text_helper_spec.rb