Question : rspec expect count to increase by 1
Answered by : puzzled-peacock-nlwdehk8n1mi
require 'rails_helper'
describe Article, type: :model do let(:create_article) { Article.create(title: 'test', description: 'test') } it 'is valid if title and description fields have value' do expect { create_article }.to change { Article.count }.by(1) end
end
Source : https://stackoverflow.com/questions/50630315/rspec-count-change-by | Last Update : Mon, 05 Jul 21