RSpec Describe class and instance methods
A useful convention has evolved within the community of
programmers who use RSpec to write tests for Ruby programs.
It is not a hard and fast rule, it cannot (at this time)
be mechanically enforced with a linter, yet it provides
an elegant and convenient semantic hint with respect to
the test. Specifically, class methods amd instance methods
differ slightly in preferred syntax as an argument to
describe
:
.
is used to prefix class methods, like so:describe '.method' do
;#
is used for instance methods:describe '#method' do
.
Using this convention is not difficult, helps the programmer stay focused the test at hand, and helps future readers of the test understand exactly what is tested.