Fix testcase

This commit is contained in:
takezoe
2015-03-03 02:38:59 +09:00
parent 19ead71b48
commit be75cef752
5 changed files with 18 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
package gitbucket.core.service
import gitbucket.core.model.GroupMember
import gitbucket.core.model.{Account, GroupMember}
import org.specs2.mutable.Specification
import java.util.Date
@@ -11,7 +11,7 @@ class AccountServiceSpec extends Specification with ServiceSpecBase {
"getAllUsers" in { withTestDB { implicit session =>
AccountService.getAllUsers() must be like{
case List(model.Account("root", "root", RootMailAddress, _, true, _, _, _, None, None, false, false)) => ok
case List(Account("root", "root", RootMailAddress, _, true, _, _, _, None, None, false, false)) => ok
}
}}

View File

@@ -1,8 +1,8 @@
package gitbucket.core.service
import gitbucket.core.model.Profile
import gitbucket.core.servlet.AutoUpdate
import gitbucket.core.util.{ControlUtil, DatabaseConfig, FileUtil}
import gitbucket.core.model.Profile._
import profile.simple._
import ControlUtil._
import java.sql.DriverManager

View File

@@ -1,15 +1,15 @@
package view
package gitbucket.core.view
import java.util.Date
import gitbucket.core.model.Account
import gitbucket.core.service.{SystemSettingsService, RequestCache}
import gitbucket.core.view.AvatarImageProvider
import gitbucket.core.controller.Context
import org.specs2.mutable._
import org.specs2.mock.Mockito
import SystemSettingsService.SystemSettings
import play.twirl.api.Html
import javax.servlet.http.HttpServletRequest
import play.twirl.api.Html
class AvatarImageProviderSpec extends Specification with Mockito {
@@ -20,7 +20,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
"getAvatarImageHtml" should {
"show Gravatar image for no image account if gravatar integration is enabled" in {
implicit val context = app.Context(createSystemSettings(true), None, request)
implicit val context = Context(createSystemSettings(true), None, request)
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
provider.toHtml("user", 32).toString mustEqual
@@ -28,7 +28,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
}
"show uploaded image even if gravatar integration is enabled" in {
implicit val context = app.Context(createSystemSettings(true), None, request)
implicit val context = Context(createSystemSettings(true), None, request)
val provider = new AvatarImageProviderImpl(Some(createAccount(Some("icon.png"))))
provider.toHtml("user", 32).toString mustEqual
@@ -36,7 +36,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
}
"show local image for no image account if gravatar integration is disabled" in {
implicit val context = app.Context(createSystemSettings(false), None, request)
implicit val context = Context(createSystemSettings(false), None, request)
val provider = new AvatarImageProviderImpl(Some(createAccount(None)))
provider.toHtml("user", 32).toString mustEqual
@@ -44,7 +44,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
}
"show Gravatar image for specified mail address if gravatar integration is enabled" in {
implicit val context = app.Context(createSystemSettings(true), None, request)
implicit val context = Context(createSystemSettings(true), None, request)
val provider = new AvatarImageProviderImpl(None)
provider.toHtml("user", 20, "hoge@hoge.com").toString mustEqual
@@ -52,7 +52,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
}
"show unknown image for unknown user if gravatar integration is enabled" in {
implicit val context = app.Context(createSystemSettings(true), None, request)
implicit val context = Context(createSystemSettings(true), None, request)
val provider = new AvatarImageProviderImpl(None)
provider.toHtml("user", 20).toString mustEqual
@@ -60,7 +60,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
}
"show unknown image for specified mail address if gravatar integration is disabled" in {
implicit val context = app.Context(createSystemSettings(false), None, request)
implicit val context = Context(createSystemSettings(false), None, request)
val provider = new AvatarImageProviderImpl(None)
provider.toHtml("user", 20, "hoge@hoge.com").toString mustEqual
@@ -68,7 +68,7 @@ class AvatarImageProviderSpec extends Specification with Mockito {
}
"add tooltip if it's enabled" in {
implicit val context = app.Context(createSystemSettings(false), None, request)
implicit val context = Context(createSystemSettings(false), None, request)
val provider = new AvatarImageProviderImpl(None)
provider.toHtml("user", 20, "hoge@hoge.com", true).toString mustEqual
@@ -112,10 +112,10 @@ class AvatarImageProviderSpec extends Specification with Mockito {
class AvatarImageProviderImpl(account: Option[Account]) extends AvatarImageProvider with RequestCache {
def toHtml(userName: String, size: Int, mailAddress: String = "", tooltip: Boolean = false)
(implicit context: app.Context): Html = getAvatarImageHtml(userName, size, mailAddress, tooltip)
(implicit context: Context): Html = getAvatarImageHtml(userName, size, mailAddress, tooltip)
override def getAccountByMailAddress(mailAddress: String)(implicit context: app.Context): Option[Account] = account
override def getAccountByUserName(userName: String)(implicit context: app.Context): Option[Account] = account
override def getAccountByMailAddress(mailAddress: String)(implicit context: Context): Option[Account] = account
override def getAccountByUserName(userName: String)(implicit context: Context): Option[Account] = account
}
}

View File

@@ -1,6 +1,5 @@
package view
package gitbucket.core.view
import gitbucket.core.view.GitBucketHtmlSerializer
import org.specs2.mutable._
class GitBucketHtmlSerializerSpec extends Specification {

View File

@@ -1,7 +1,6 @@
package view
package gitbucket.core.view
import gitbucket.core.util.ControlUtil
import gitbucket.core.view.Pagination
import org.specs2.mutable._
import ControlUtil._