File: buffer_ext_spec.rb

package info (click to toggle)
ruby-neovim 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 548 kB
  • sloc: ruby: 4,178; sh: 23; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 851 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
require "helper"
require "neovim/ruby_provider/buffer_ext"

module Neovim
  RSpec.describe Buffer do
    let!(:nvim) do
      Support.persistent_client.tap do |client|
        stub_const("::Vim", client)
      end
    end

    describe ".current" do
      it "returns the current buffer from the global Vim client" do
        expect(Buffer.current).to eq(nvim.get_current_buf)
      end
    end

    describe ".count" do
      it "returns the current buffer count from the global Vim client" do
        expect do
          nvim.command("new")
        end.to change { Buffer.count }.by(1)
      end
    end

    describe ".[]" do
      it "returns the buffer from the global Vim client at the given index" do
        buffer = Buffer[0]

        expect(buffer).to be_a(Buffer)
        expect(buffer).to eq(nvim.list_bufs[0])
      end
    end
  end
end