I have been told that it makes sense to use let!()
instead of before(:each)
block, however I can't see much of a logic doing that. Does it actually make any sense of making something like in the example below
context 'my super context' do
let!(:something) do
Model.create(subject: "Hello", body: "World")
end
it '...' do
# We never call something
# All we want is just evaluate and create
# the record
end
end
Keep in mind that you won't call something
anywhere in the example at all. Technically I don't see much of the difference with this, unless it's actually more strict and easy to understand without documentation just like plain English
context 'my super context' do
before(:each) do
Model.create(subject: "Hello", body: "World")
end
it '...' do
# We never call something
# All we want is just evaluate and create
# the record
end
end
Could someone help me to get the idea behind? Thank you very much!
Aucun commentaire:
Enregistrer un commentaire