I would like to create function specifications for finding Patients in my practice management application.
So far I have searched the network and followed the proposed solutions:
http://bitsandbit.es/post/11295134047/unit-testing-with-tire-and-elastic-search#disqus_thread
and
https://github.com/karmi/tire/wiki/Integration-Testing-Rails-Models-with-Tire
Both of these articles suggested spec_helper.rb configurations for ElasticSearch and Tire. Since Searchkick was based on Tire, I applied solutions for the Patient class, which is the only model in which I use Searchkick.
However, I get a "NoMEthodError" for each of the configurations. For example, using the following code:
spec_helper.rb
RSpec.configure do |config| do . . . config.before :each do Patient.index.delete Patient.create_elasticsearch_index end config.before :all do Patient.index_name('test' + Patient.model_name.plural) end end
I get the following error:
Failure/Error: Unable to find matching line from backtrace NoMethodError: undefined method `index_name'
The same thing happens with the "index" and "create_elasticsearch_index" methods
I am new to RoR, and to be honest, I'm not sure what I can do wrong here, except maybe on the assumption that I can use Tire solutions on Searchkick. Therefore, any help is greatly appreciated!
source share