# This is code I pulled in from another project to mock the # `update_attributes!` method. Sorry about the noise. module MockUpdateAttributes def mock_update_attributes_on(model) update_proc = proc do |attrs| attrs.each do |attr,value| setter = "#{attr}=".to_sym expect(model).to respond_to attr expect(model).to respond_to setter model.public_send setter, value end end allow(model).to receive(:update_attributes!, &update_proc) model end end