Skip to content

Instantly share code, notes, and snippets.

@roberson-miguel
Created January 23, 2020 11:31
Show Gist options
  • Save roberson-miguel/16e57cc0390f22f0be6cd726b60a1740 to your computer and use it in GitHub Desktop.
Save roberson-miguel/16e57cc0390f22f0be6cd726b60a1740 to your computer and use it in GitHub Desktop.
Teste de uso! WIP
Boa noite galera, eu e a @Larissa Porto fizemos um teste para assegurar que o patch não criou um objeto novo no banco, segue o código:
it 'should not create another car' do
car = create(:car, license_plate:'ABC-0987')
expect{
patch api_v1_car_path(car), params: {license_plate: 'DEF-1234'}
}.to change(Car, :count).by(0)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment