, - ( ), rspec expectations, :
it 'should hide previous [objects] create a new updated one' do
items = MyItems.where(:type => :user_did_something)
expect { 2.times { user.log_activity(:user_did_something) } }.
to change { items.count }.from(0).to(2)
end
[]
( , , ), rspec lazy-loading let, :
let(:items_count) { MyItems.where(:type => :user_did_something).count }
it 'should hide previous [objects] create a new updated one' do
expect { 2.times { user.log_activity(:user_did_something) } }.
to change { items_count }.from(0).to(2)
end