Sha256: 8b7538254448e8894d36ffdfdbebb69b86c6ce600bbae9bd513ee2832253a3d7

Contents?: true

Size: 908 Bytes

Versions: 6

Compression:

Stored size: 908 Bytes

Contents

require "helper"
require "neovim/ruby_provider/buffer_ext"

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

    after { nvim.shutdown }

    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 {
          nvim.command("new")
        }.to change { Buffer.count }.by(1)
      end
    end

    describe ".[]" do
      it "returns the buffer from the global Vim client at the given index" do
        expect(Buffer[0]).to eq(nvim.get_current_buf)
        nvim.command("new")
        expect(Buffer[1]).to eq(nvim.get_current_buf)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
neovim-0.7.0 spec/neovim/ruby_provider/buffer_ext_spec.rb
neovim-0.6.2 spec/neovim/ruby_provider/buffer_ext_spec.rb
neovim-0.6.1 spec/neovim/ruby_provider/buffer_ext_spec.rb
neovim-0.6.0 spec/neovim/ruby_provider/buffer_ext_spec.rb
neovim-0.5.1 spec/neovim/ruby_provider/buffer_ext_spec.rb
neovim-0.5.0 spec/neovim/ruby_provider/buffer_ext_spec.rb