In-Memory vs. Database
It's important to understand the difference from in-memory and the database. Any ruby code you write is in-memory. For instance, whenever a query is executed, it creates a new in-memory object with the corresponding data from the database.
# @student is a in-memory object representing the first row in the Students table.
@student = Student.first
Your example
Here is your example with comments for explanation
it "should be saved as all lower-case" do
# @user is an in-memory ruby object. You set it's email to "Foo@ExAMPle.CoM"
@user.email = mixed_case_email
# You persist that objects attributes to the database.
# The database stores the email as downcase probably due to a database constraint or active record callback.
@user.save
# While the database has the downcased email, your in-memory object has not been refreshed with the corresponding values in the database.
# In other words, the in-memory object @user still has the email "Foo@ExAMPle.CoM".
# use reload to refresh @user with the values from the database.
expect(@user.reload.email).to eq mixed_case_email.downcase
end
To see a more thorough explanation see this post.