Skip to content
Browse files

added hibernate plugin for integration testing and fixed BlogEntryInt…

…egrationTests
  • Loading branch information...
1 parent 2377551 commit 0a5f7b54eab4d50f17cdb0c2d8f3064c19d76442 @burtbeckwith burtbeckwith committed Feb 5, 2013
View
4 grails-app/conf/BuildConfig.groovy
@@ -26,5 +26,9 @@ grails.project.dependency.resolution = {
compile ':feeds:1.5'
compile ':commentable:0.8.1'
compile ':taggable:1.0.1'
+
+ runtime ":hibernate:$grailsVersion", {
+ export = false
+ }
}
}
View
39 test/integration/org/grails/blog/BlogEntryIntegrationTests.groovy
@@ -1,73 +1,50 @@
package org.grails.blog
-import grails.test.GrailsUnitTestCase
-
import org.grails.comments.Comment
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-class BlogEntryIntegrationTests extends GrailsUnitTestCase {
- def entry
- def poster
+class BlogEntryIntegrationTests extends GroovyTestCase {
+
+ private BlogEntry entry = new BlogEntry(title: "blog Title", body: "Dummy Entry", author: "Author")
+ private FakeUser poster
- @Before
- void before() {
+ @Override
+ protected void setUp() {
super.setUp()
createNewEntry()
}
- @After
- void after() {
- super.tearDown()
- entry.delete(flush:true)
- }
-
- void createNewEntry() {
- entry = new BlogEntry()
- entry.title = "blog Title"
- entry.body = "Dummy Entry"
- entry.dateCreated = new Date()
- entry.lastUpdated = new Date()
- entry.author = "Author"
-
+ private void createNewEntry() {
assertNotNull entry.save(flush:true)
assertNotNull entry.id
}
- @Test
void testBlogEntryShouldBeginWithNoComments() {
assertNotNull entry.getComments()
assertTrue entry.comments.empty
}
- @Test
void testBlogEntryShouldCanReceiveComments() {
poster = new FakeUser()
entry.addComment(poster, "MyComment")
assertEquals 1, Comment.count()
assertEquals 1, entry.comments.size()
}
- @Test
void testBlogEntryShouldBeAbleToReceiveTags() {
entry.addTag("posts")
entry.addTag("test")
entry.addTag("videos")
- def tags = ["posts", "test", "videos"]
- assertEquals tags, entry.tags
+ assertEquals(["posts", "test", "videos"], entry.tags)
}
- @Test
void shouldBeSearcheableByTitle() {
def result = BlogEntry.search("*title*")
assertNotNull result
print result.results
assertEquals 1, result.results.size()
}
- @Test
void shouldBeSearcheableByAuthor() {
def result = BlogEntry.search("Dummy")
assertNotNull result

0 comments on commit 0a5f7b5

Please sign in to comment.
Something went wrong with that request. Please try again.