Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created October 9, 2012 16:35
Show Gist options
  • Select an option

  • Save Heavyblade/3859923 to your computer and use it in GitHub Desktop.

Select an option

Save Heavyblade/3859923 to your computer and use it in GitHub Desktop.
vspec sample
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Test Suite xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SpecsDatabaseCleaner()
describe("Articles Behavior", function(){
it("should create an article", function(){
Factory.create("article");
var narticulos = cargarLista("ARTICULOS").listSize();
expect(1).toEqual(narticulos)
});
it("should set a default price in the article", function(){
var article = Factory.create("article");
var price1 = new VRegister(theRoot);
price1.create("LIONDAT/PRECIOS", {articulos: article.fieldToInt("ID"), "por_defecto": 0, precio: 10})
var price2 = new VRegister(theRoot);
price2.create("LIONDAT/PRECIOS", {articulos: article.fieldToInt("ID"), "por_defecto": 1, precio: 20})
var reloaded_article = cargarLista("ARTICULOS").readAt(0)
expect(reloaded_article.fieldToInt("PRECIO_DEF")).toEqual(20);
});
it("should be able to update the default price", function() {
var article = Factory.create("article");
var price1 = new VRegister(theRoot);
price1.create("LIONDAT/PRECIOS", {articulos: article.fieldToInt("ID"), "por_defecto": 1, precio: 10})
var price2 = new VRegister(theRoot);
price2.create("LIONDAT/PRECIOS", {articulos: article.fieldToInt("ID"), "por_defecto": 0, precio: 20})
var reloaded_price = cargarLista("PRECIOS").readAt(1)
reloaded_price.setField("POR_DEFECTO", 1)
reloaded_price.modifyRegister()
var reloaded_article = cargarLista("ARTICULOS").readAt(0)
expect(reloaded_article.fieldToInt("PRECIO_DEF")).toEqual(10);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment