Permalink
Browse files

Improved support for hibernate session

  • Loading branch information...
1 parent 50c79df commit ab86a4df4fb5289a733b5997daf24bdef4b6d6c6 Matias waisgold committed Sep 15, 2010
@@ -1,9 +1,9 @@
class StoriesGrailsPlugin {
- def version = 0.17
+ def version = 0.19
def title = "A BDD plugin for grails"
def grailsVersion = "1.3.1 > *"
- def author = "Jonathan Leibiusky"
- def authorEmail = "ionathan@gmail.com"
+ def author = "Jonathan Leibiusky, Matias Waisgold"
+ def authorEmail = "ionathan@gmail.com, mwaisgold@gmail.com"
def description = "Stories is a BDD plugin for Grails that aims to make you life easier with functional testing. Stories does't depend on any testing framework out there. It tries to use them all, offerind a way to organize your tests as Stories and Scenarios. What you do inside each scenario is your problem :)... you can use either Selenium, WebTest, HtmlUnit, etc."
def documentation = "http://github.com/xetorthio/stories"
def loadAfter = ['core', 'hibernate']
View
@@ -1,7 +1,7 @@
#Grails Metadata file
-#Thu Jun 17 18:05:01 ART 2010
-app.grails.version=1.3.1
+#Wed Sep 15 11:41:02 ART 2010
+app.grails.version=1.3.4
app.name=stories
-plugins.hibernate=1.3.1
+plugins.hibernate=1.3.4
plugins.rest=0.3
-plugins.tomcat=1.3.1
+plugins.tomcat=1.3.4
@@ -4,5 +4,6 @@ class Book {
String title
static constraints = {
+ title(unique: true)
}
}
@@ -24,12 +24,11 @@ class ScenarioTest extends TestCase {
if (clientHelper){
code.delegate = clientHelper
}
- sessionFactory.currentSession.beginTransaction()
code()
- sessionFactory.currentSession.transaction.rollback()
}
protected void setUp() {
+ sessionFactory.currentSession.beginTransaction()
if(before) {
before()
}
@@ -39,6 +38,7 @@ class ScenarioTest extends TestCase {
if(after) {
after()
}
+ sessionFactory.currentSession.transaction.rollback()
}
}
@@ -6,6 +6,10 @@ story "This is a story", {
before {
ranBefore = true;
+ assert Book.findByTitle("Test") == null //This tests that every story is complete independant
+ def b = new Book()
+ b.title = "Test"
+ b.save()
}
after {
@@ -25,7 +29,7 @@ story "This is a story", {
scenario "It is possible to use domains", {
def b = new Book()
- b.title = "Test"
+ b.title = "TestTitle"
b.save()
assert b != null;
}
@@ -39,6 +43,6 @@ story "This is a story", {
}
scenario "It is transactional", {
- assert Book.findByTitle("Test") == null
+ assert Book.findByTitle("TestTitle") == null
}
}

0 comments on commit ab86a4d

Please sign in to comment.