Rspec test gems

I developed a gem to be used inside the model by adding acts_as_gmappable and you can pass parameters in the declaration.

Now that I want to write tests using Rspec, I am stuck for all model related functions:

  • check the correct execution of geocoding
  • check I create the correct json from all database entries
  • etc.

I know how to do this in a Rails application, but definitely not for the gem. Any track?

+3
source share
1 answer

I managed to do this by reading the excellent book of Jose Valim:

http://plataformatec.com.br/crafting-rails-applications/

He describes how he tests his gem using his construction engine:

https://github.com/josevalim/enginex

+3
source

Source: https://habr.com/ru/post/1345683/


All Articles