mercredi 17 août 2016

How to test persistent data with a database view in rails?

I am trying the next text:

product = Product.new
product.created_by = "admin"
product.reference = "a computer"
product.amount = 1000
product.payed = true    

assert product.save

total = ProductBalance.total_balance

Where ProductBalance is a view in the database, it calculates the total of product that have been "payed"( product.payed = true )

but when I run this test it doesn't affect the ProductBalance.total_balance

I made a exact clone of the develoment database for the test enviroment, I can see the ProductBalance.total_balance of the data that are already in the database no the one that I want to test

Aucun commentaire:

Enregistrer un commentaire