I've just joined a new company and when I'm using the select2 method in Rspec, I get the following error: NoMethodError:undefined method `select2' for...
We use the 'capybara-select-2' gem.
So I added in spec_helper.rb the following config: config.include CapybaraSelect2 and it's perfectly works. Problem, when tests are pushed on heroku, it raises an error: uninitialized constant CapybaraSelect2.
The weird thing is my colleague doesn't need to add the config line for using this method...
Do you have any idea why he can use it without it and I can't? Thanks for your help.
My CTO finally found a way to make my code working:
I was calling
config.include CapybaraSelect2at the end ofspec_helper.rbso he moved it withinrails_helper.rb, just as following:Everything works fine now!