Testing a Ruby Singleton
Unit testing a singleton class can cause problems since you're using the same instance across all the specs, and thus the state will be effected by each test. To get around this, try creating an anonymous subclass for each test:
let(:resource) { Class.new(UniqueResource) }
Written by Paul Guelpa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#