Forum: Rails deployment Rspec Self Class Method Access

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
74a905997dd2f6c0d64eaf5bfbec0b0f?d=identicon&s=25 Jan Yo (rocl)
on 2014-10-03 00:35
I have a class that have self methods.

Class X < ActiveRecord::Base
   self.do_something { puts 'do something' }
end


The model spec uses Factory Girl so an instance is created on the class.
When run rspec, do_something is not recognized.

How do I access X.do_something in rspec?  Also, please provide an
example of a small test (i.e., expect) with do_something.

Thanks!
This topic is locked and can not be replied to.