AgileVentures / osra

Sponsor orphans in Syria & ensure basic life & education requirements for Syrian children
MIT License
20 stars 39 forks source link

Add cashbox model [OSRA-451] #441

Closed Maroo-b closed 7 years ago

Maroo-b commented 7 years ago
Maroo-b commented 7 years ago

@b264 I added unit tests to the changes. I'm curious to know about the value of model association tests ? Do you often add association tests ?

NikitaAvvakumov commented 7 years ago

@Maroo-b re: association tests - my 2 cents is that they have marginal utility during TDD but lose all value once code has been written

Maroo-b commented 7 years ago

@NikitaAvvakumov thanks for the answer :) From my side I usually avoid adding tests for association because I have the feeling that I'm testing the framework, and in case I added them in strict TDD session I vote for removing them afterwards.

Maroo-b commented 7 years ago

I updated the PR to calculate the balance from payment, and I didn't add the validation on Payment destination FK because there is the case of withdrawal from sponsorship cashbox.

Maroo-b commented 7 years ago

@NikitaAvvakumov validation for Payment amount is added