File: library_command_spec.rb

package info (click to toggle)
yard 0.9.37-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,720 kB
  • sloc: ruby: 31,354; javascript: 7,608; makefile: 21
file content (38 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true

RSpec.describe YARD::Server::Commands::LibraryCommand do
  before do
    allow(Templates::Engine).to receive(:render)
    allow(Templates::Engine).to receive(:generate)
    allow(YARD).to receive(:parse)
    allow(Registry).to receive(:load)
    allow(Registry).to receive(:save)

    @cmd = LibraryCommand.new(:adapter => mock_adapter)
    @request = mock_request("/foo", :xhr? => false)
    @library = OpenStruct.new(:source_path => '.')
    @cmd.library = @library
    allow(@cmd).to receive(:load_yardoc).and_return(nil)
  end

  def call
    expect { @cmd.call(@request) }.to raise_error(NotImplementedError)
  end

  describe "#call" do
    it "raises NotImplementedError" do
      call
    end

    it "sets :rdoc as the default markup in incremental mode" do
      @cmd.incremental = true
      call
      expect(@cmd.options[:markup]).to eq :rdoc
    end

    it "sets :rdoc as the default markup in regular mode" do
      call
      expect(@cmd.options[:markup]).to eq :rdoc
    end
  end
end