neovim / neovim-ruby

Ruby support for Neovim
MIT License
340 stars 17 forks source link

Testing a Ruby plugin #71

Closed bweave closed 3 years ago

bweave commented 3 years ago

How would I go about setting up testing with Minitest for a Ruby plugin? Did I miss that in the docs somewhere?

Thanks!

alexgenco commented 3 years ago

I think you have a couple options here:

  1. Write unit-style tests like the ones in neovim-ruby itself: https://github.com/neovim/neovim-ruby/blob/main/spec/neovim/plugin_spec.rb
  2. Write more integration-level tests using a vim test suite such as themis or vspec. neovim-ruby actually has a themis test suite, and here's a nice vimcast on vspec.

If you come up with any ideas for utilities in neovim-ruby itself to facilitate testing, feel free to report back. This is the first time it has come up!

bweave commented 3 years ago

For anyone else who might find it useful, I ended up extracting the bits I care about testing out into a class and calling that class from the Nvim.plugin call. You can check it out here: https://github.com/bweave/nvim-plugins. ❤️ that I can skip the Vimscript and create the functionality I want/need in the language I love!