]> git.saurik.com Git - redis.git/blob - client-libraries/scala/src/test/scala/com/redis/operations/SortOperationsSpec.scala
95f3c91dd6a6bdecb00febfb1483838358fcbe10
[redis.git] / client-libraries / scala / src / test / scala / com / redis / operations / SortOperationsSpec.scala
1 import org.specs._
2 import com.redis._
3
4 import org.specs.mock.Mockito
5 import org.mockito.Mock._
6 import org.mockito.Mockito._
7
8 object SortOperationsSpec extends Specification with Mockito {
9
10 "Redis Client Sort Operations" should {
11
12 var client: RedisTestClient = null
13 var connection: Connection = null
14
15 doBefore{
16 connection = mock[Connection]
17 client = new RedisTestClient(connection)
18 }
19
20 "sort the contents of the specified key" in {
21 val listResult: List[String] = List("one", "two", "three")
22 connection.readList returns listResult
23 client.sort("set", "ALPHA DESC") mustEqual listResult
24 connection.write("SORT set ALPHA DESC\r\n") was called
25 }
26
27 "sort the contents of the specified key with default" in {
28 val listResult: List[String] = List("one", "two", "three")
29 connection.readList returns listResult
30 client.sort("set") mustEqual listResult
31 connection.write("SORT set\r\n") was called
32 }
33 }
34 }