File: window_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 (45 lines) | stat: -rw-r--r-- 1,042 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
39
40
41
42
43
44
45
require "helper"

module Neovim
  RSpec.describe Window do
    let(:client) { Support.persistent_client }
    let(:window) { client.current.window }

    before do
      client.command("normal ione")
      client.command("normal otwo")
      client.command("normal gg")
      client.command("vsplit")
    end

    describe "#buffer" do
      it "returns the window's buffer" do
        expect(window.buffer).to eq(client.get_current_buf)
      end
    end

    describe "#height", "#height=" do
      it "adjusts the window height" do
        expect do
          window.height -= 1
        end.to change { window.height }.by(-1)
      end
    end

    describe "#width", "#width=" do
      it "adjusts the window width" do
        expect do
          window.width -= 1
        end.to change { window.width }.by(-1)
      end
    end

    describe "#cursor", "#cursor=" do
      it "adjusts the window cursor" do
        expect do
          window.cursor = [2, 0]
        end.to change { window.cursor }.to([2, 0])
      end
    end
  end
end