Sha256: 2655f4f4402b3e4343c985b38dc47c6bc6af6ff9bbba63cbae5a5e07c0cafb97

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

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

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

8 entries across 7 versions & 2 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/yard-0.9.2/spec/templates/constant_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/spec/templates/constant_spec.rb
yard-0.9.5 spec/templates/constant_spec.rb
yard-0.9.4 spec/templates/constant_spec.rb
yard-0.9.3 spec/templates/constant_spec.rb
yard-0.9.2 spec/templates/constant_spec.rb
yard-0.9.1 spec/templates/constant_spec.rb
yard-0.9.0 spec/templates/constant_spec.rb