DEV Community

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

Posted on • Edited on

1

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)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay