DEV Community

Cover image for Today I learned - more about rspec.
Juan Vasquez
Juan Vasquez

Posted on • Updated on

Today I learned - more about rspec.

Today is 04-01-2021

I was writing a callback test in RoR with RSpec.

When I noticed that I forgot the standard how should I write the description for after_create and this is the answer.

describe "#after_create"
end
Enter fullscreen mode Exit fullscreen mode

The convention for class methods says, they should be writing prefixed with ..

The convention for instance methods says, they should be writing prefixed with #.

Example.

# class methods

User.actives

description ".actives"
end
Enter fullscreen mode Exit fullscreen mode
# instance methods

current_user.send_welcome_notification

description "#send_welcome_notification"
end
Enter fullscreen mode Exit fullscreen mode

I hope this will be helpful, see you tomorrow!

Top comments (0)