I create RSpec test below. I try to call subject several times. But I cannot get expected result. I call subject three times, doesn't it? So, I expect three Book records. Does subject cannot call one time?
require 'rails_helper'
RSpec.describe Book, type: :model do
context 'some context' do
subject { Book.create }
before do
subject
end
it 'something happen' do
subject
expect { subject }.to change{ Book.count }.from(0).to(3)
end
end
end