I have trouble with testing model count through feature/scenario rspec instrument
require 'spec_helper'
feature 'Registration' do
scenario 'Guest can sign up as individual' do
with_role(:guest)
sign_up(:client)
Individual.count.should == 1
# should be replaced by expect{ sign_up(:client) }.to change{ Individual.count }.by(1)
end
end
How can I replace model.count should to the expect in the block to expecting in scenario? I don't want to use should because of record count changes every time I use it
Regards, Alex
The correct way of using the change matcher of rspec is as follows: