Sha256: eeda958243f22cfe6eecbf0ab0c21b29ee57cc426e88c8f53042c6f492c8a66e

Contents?: true

Size: 1.43 KB

Versions: 21

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"

RSpec.describe YARD::Templates::Engine.template(:default, :constant) do
  describe "fully dressed constant" do
    it "renders text format correctly" do
      YARD.parse_string <<-'eof'
        class YARD::CLI::YRI
          # Default search paths that should be loaded dynamically into YRI. These paths
          # take precedence over all other paths ({SEARCH_PATHS_FILE} and RubyGems
          # paths). To add a path, call:
          #
          #   DEFAULT_SEARCH_PATHS.push("/path/to/.yardoc")
          #
          # @return [Array<String>] a list of extra search paths
          # @since 0.6.0
          DEFAULT_SEARCH_PATHS = []
        end
      eof
      text_equals(Registry.at('YARD::CLI::YRI::DEFAULT_SEARCH_PATHS').format(text_options), :constant001)
    end
  end

  describe "simple constant with no documentation" do
    it "renders text format correctly" do
      # Short constant should show on single line
      YARD.parse_string <<-'eof'
        MYCONST = 'foo'
      eof
      text_equals(Registry.at('MYCONST').format(text_options), :constant002)

      # Long constant should show on multiple lines, indented
      YARD.parse_string <<-'eof'
        MYCONST = [A, B, C, D, E, F, G, H, I, J, K, L,
          M, N, O, P, Q, R, S, T, U, V, W,
          X, Y, Z]
      eof
      text_equals(Registry.at('MYCONST').format(text_options), :constant003)
    end
  end
end

Version data entries

21 entries across 20 versions & 4 rubygems

Version Path
yard-0.9.24 spec/templates/constant_spec.rb
yard-0.9.23 spec/templates/constant_spec.rb
yard-0.9.22 spec/templates/constant_spec.rb
yard-0.9.21 spec/templates/constant_spec.rb
yard-0.9.20 spec/templates/constant_spec.rb
yard-0.9.19 spec/templates/constant_spec.rb
yard-0.9.16 spec/templates/constant_spec.rb
yard-0.9.15 spec/templates/constant_spec.rb
yard-0.9.14 spec/templates/constant_spec.rb
yard-0.9.13 spec/templates/constant_spec.rb
yard-0.9.12 spec/templates/constant_spec.rb
yard-0.9.11 spec/templates/constant_spec.rb
yard-0.9.10 spec/templates/constant_spec.rb
yard-0.9.9 spec/templates/constant_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/spec/templates/constant_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/spec/templates/constant_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/spec/templates/constant_spec.rb
yard-0.9.8 spec/templates/constant_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/spec/templates/constant_spec.rb
yard-0.9.7 spec/templates/constant_spec.rb