This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// load this script in `play console` via | ||
// :load scripts/console.scala | ||
val app = new play.core.StaticApplication(new java.io.File(".")) | ||
import play.api.Play.current | ||
val conf = current.configuration | ||
|
||
import hedgehog.models._ | ||
val userAccount = GithubUser("user", Some("http://example.com/u.png")) | ||
val orgAccount = GithubOrg("org", Some("http://example.com/o.png")) | ||
|
||
val userAccountSettings = new AccountSettings(userAccount, includePrivateRepos = false) | ||
val orgAccountSettings = new AccountSettings(orgAccount, includePrivateRepos = true) | ||
val accountSettings = userAccountSettings :: orgAccountSettings :: Nil | ||
|
||
val userRepoA = new Repo("a", userAccount, Some("some description a")) | ||
val userRepoB = new Repo("b", userAccount, Some("some description b")) | ||
val userRepos = userRepoA :: userRepoB :: Nil | ||
|
||
val orgRepoZ = new Repo("z", orgAccount, Some("some description z"), isPrivate = Some(true)) | ||
val orgRepoY = new Repo("y", userAccount, Some("some description y"), isPrivate = Some(false)) | ||
val orgRepos = orgRepoZ :: orgRepoY :: Nil | ||
|
||
val repos = userRepos ++ userRepos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package test | ||
|
||
import org.scalatest._ | ||
|
||
import org.junit.runner.RunWith | ||
import org.scalatest.junit.JUnitRunner | ||
|
||
import hedgehog.models.{GithubUser, AccountSettings} | ||
|
||
/** | ||
* Copyright (c) Nikita Kovaliov, maizy.ru, 2014 | ||
* See LICENSE.txt for details. | ||
*/ | ||
@RunWith(classOf[JUnitRunner]) | ||
class AccountSettingsSuite extends FunSuite with Matchers { | ||
|
||
test("hash equals for the same content") { | ||
val user1 = GithubUser("user") | ||
val user2 = GithubUser("user") | ||
assert(user1.hashCode === user2.hashCode) | ||
val accountSettings1 = new AccountSettings(user1, true) | ||
val accountSettings2 = new AccountSettings(user2, true) | ||
assert(accountSettings1.hashCode === accountSettings2.hashCode) | ||
val accountSettings3 = new AccountSettings(user1, false) | ||
assert(accountSettings1.hashCode !== accountSettings3.hashCode) | ||
} | ||
} |