Simplify specs with matchers and methods
You want your specs to be short and sweet. Sometimes some libs provide custom matchers and helpers that can make your "testing life" easy.
let(:user) { FactoryGirl.build :user }
let(:other_user) { FactoryGirl.create :other_user }
After extending your RSpec.configure
block with some methods.
RSpec.configure do
config.include FactoryGirl::Syntax::Methods
...
end
You can just write.
let(:user) { build :user }
let(:other_user) { create :other_user }
Written by Oto Brglez
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#