Sha256: eb3c1bb4f0adaed60ee7467f00c845e98203cff4eae7deafb7ca1c6eac176aaa

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

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

describe YARD::CLI::Display do
  before do
    allow(Registry).to receive(:load)
    @object = CodeObjects::ClassObject.new(:root, :Foo)
    @object.docstring = 'Foo bar'
  end

  it "displays an object" do
    YARD::CLI::Display.run('-f', 'text', 'Foo')
    expect(log.io.string.strip).to eq(@object.format.strip)
  end

  it "wraps output with -l (defaulting to layout)" do
    YARD::CLI::Display.run('-l', '-f', 'html', 'Foo')
    formatted_output = @object.format(:format => :html).strip
    actual_output = log.io.string.strip
    expect(actual_output).not_to eq(formatted_output)
    expect(actual_output).to include(formatted_output)
  end

  it "wraps output with --layout onefile" do
    YARD::CLI::Display.run('--layout', 'onefile', '-f', 'html', 'Foo')
    formatted_output = @object.format(:format => :html).strip
    actual_output = log.io.string.strip
    expect(actual_output).not_to eq(formatted_output)
    expect(actual_output).to include(formatted_output)
  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/cli/display_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/spec/cli/display_spec.rb
yard-0.9.5 spec/cli/display_spec.rb
yard-0.9.4 spec/cli/display_spec.rb
yard-0.9.3 spec/cli/display_spec.rb
yard-0.9.2 spec/cli/display_spec.rb
yard-0.9.1 spec/cli/display_spec.rb
yard-0.9.0 spec/cli/display_spec.rb