Recently I setup up Rspec and Cucumber for an old rails project. When trying to use fixtures in my specs, I came across the following error when running via autotest:
/home/jmacdonald/.rvm/gems/ruby-1.8.7-p302/gems/rspec-rails-1.3.3/lib/autotest/rails_rspec.rb:38: undefined method `singularize' for "users":String (NoMethodError)
from /home/jmacdonald/.rvm/gems/ruby-1.8.7-p302/gems/ZenTest-4.4.0/lib/autotest.rb:511:in `call'
from /home/jmacdonald/.rvm/gems/ruby-1.8.7-p302/gems/ZenTest-4.4.0/lib/autotest.rb:511:in `test_files_for'
from /home/jmacdonald/.rvm/gems/ruby-1.8.7-p302/gems/ZenTest-4.4.0/lib/autotest.rb:383:in `find_files_to_test'...
Requiring ‘active_support/inflector’ to the beginning of the ~/.autotest file seems to ensure that the singularize method is available.
# required to allow rails_rspec.rb to use the rails string singularize method
require 'active_support/inflector'
Autotest.add_hook :initialize do |autotest|
%w{.git vendor}.each {|exception| autotest.add_exception(exception) }
end
you saved my life. Thanks!
Helped me, too. Thanks!
You’re most welcome. Glad to help!
Good information never gets old. Thanks!
Thanks!!
you also saved the life of Japanese. i love you!