I try to have best-practice-conforming RSpec tests, and I know that when testing an instance method, one can do
describe "#my_instance_method" do ... end
But what about class methods? Should I add a self.
to it in the description string?
describe "#self.my_class_method" do ... end
Thanks for your opinion!
From "How to name RSpec describe blocks for methods":
#method
for instance methods.method
for class methodsIn your example:
describe "#my_instance_method" do
# ...
end
describe ".my_class_method" do
# ...
end
A few examples from rspec-core: for class method, for instance method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With