Answers for "rspec expect count to increase by 1"

0

rspec expect count to increase by 1

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
Posted by: Guest on June-28-2021

Browse Popular Code Answers by Language