File: base_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 (24 lines) | stat: -rw-r--r-- 775 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

RSpec.describe YARD::Parser::Base do
  describe "#initialize" do
    class MyParser < Parser::Base; def initialize(a, b) end end

    it "takes 2 arguments" do
      expect { YARD::Parser::Base.new }.to raise_error(ArgumentError,
        /wrong (number|#) of arguments|given 0, expected 2/)
    end

    it "raises NotImplementedError on #initialize" do
      expect { YARD::Parser::Base.new('a', 'b') }.to raise_error(NotImplementedError)
    end

    it "raises NotImplementedError on #parse" do
      expect { MyParser.new('a', 'b').parse }.to raise_error(NotImplementedError)
    end

    it "raises NotImplementedError on #tokenize" do
      expect { MyParser.new('a', 'b').tokenize }.to raise_error(NotImplementedError)
    end
  end
end