Skip to content
Browse files

2.9.2 cross compile and junit

not using specs anymore since it's a pain to
maintain version mapping.  also, junit's a lot
easier for me to understand.
  • Loading branch information...
1 parent b90174a commit 2c7dc5e38166e622580ff5a58c9e49de285c5123 @hoffrocket hoffrocket committed
View
9 CHANGELOG
@@ -0,0 +1,9 @@
+0.3.1
+------
+release: 27 April 2012
+
+ - cross compile for scala 2.9.2, no new features or fixes
+ - maintaining a specs version mapping is too painful, junit ftw
+
+for 0.3.0 and older:
+ - sorry for starting this log so late. you'll have to see the commit history
View
4 README.textile
@@ -47,7 +47,7 @@ h2. Installation
h3. sbt
<code>
- val scalaj_http = "org.scalaj" %% "scalaj-http" % "0.3.0"
+ val scalaj_http = "org.scalaj" %% "scalaj-http" % "0.3.1"
</code>
h3. maven
@@ -56,7 +56,7 @@ h3. maven
<dependency>
<groupId>org.scalaj</groupId>
<artifactId>scalaj-http_${scala.version}</artifactId>
- <version>0.3.0</version>
+ <version>0.3.1</version>
</dependency>
</code></pre>
View
16 build.sbt
@@ -1,24 +1,18 @@
name := "scalaj-http"
-version := "0.3.0"
+version := "0.3.1"
organization := "org.scalaj"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq(
- "commons-codec" % "commons-codec" % "1.5" % "compile"
+ "commons-codec" % "commons-codec" % "1.5" % "compile" withSources(),
+ "junit" % "junit" % "4.10" % "test" withSources(),
+ "com.novocode" % "junit-interface" % "0.8" % "test"
)
-crossScalaVersions := Seq("2.8.0", "2.8.1", "2.9.1")
-
-libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps) =>
- // select the specs version based on the Scala version
- val versionMap = Map("2.8.0" -> "1.6.5", "2.8.1" -> "1.6.8", "2.9.1" -> "1.6.9")
- val testVersion = versionMap.getOrElse(sv, error("Unsupported Scala version " + sv))
- // append the specs dependency to the existing dependencies
- deps :+ ("org.scala-tools.testing" %% "specs" % testVersion)
-}
+crossScalaVersions := Seq("2.8.0", "2.8.1", "2.9.1", "2.9.2")
publishTo <<= version { v: String =>
val nexus = "https://oss.sonatype.org/"
View
35 src/test/scala/scalaj/http/HttpSpec.scala
@@ -1,35 +0,0 @@
-package scalaj.http
-
-import org.specs._
-import scalaj.http.Http._
-
-class HttpSpec extends Specification {
- "Http" should {
- "prepend options" in {
- val http = Http("http://localhost")
- val origOptions = http.options
- val origOptionsLength = origOptions.length
- val newOptions: List[HttpOptions.HttpOption] = List(c => { }, c=> { }, c => {})
- val http2 = http.options(newOptions)
-
- http2.options.length must_== origOptionsLength + 3
- http2.options.take(3) must_== newOptions
- origOptions.length must_== origOptionsLength
- }
-
- "last timeout value should win" in {
- val getFunc: HttpExec = (req,conn) => {
-
- }
-
- val r = Request(getFunc, Http.noopHttpUrl("http://localhost"), "GET").options(HttpOptions.connTimeout(1234)).options(HttpOptions.readTimeout(1234))
- r.process(c => {
- c.getReadTimeout must_== 1234
- c.getConnectTimeout must_== 1234
- })
-
- }
- }
-
-
-}
View
35 src/test/scala/scalaj/http/HttpTest.scala
@@ -0,0 +1,35 @@
+package scalaj.http
+
+import org.junit.Assert._
+import org.junit.Test
+import scalaj.http.Http._
+
+class HttpTest {
+
+ @Test
+ def shouldPrependOptions: Unit = {
+ val http = Http("http://localhost")
+ val origOptions = http.options
+ val origOptionsLength = origOptions.length
+ val newOptions: List[HttpOptions.HttpOption] = List(c => { }, c=> { }, c => {})
+ val http2 = http.options(newOptions)
+
+ assertEquals(http2.options.length, origOptionsLength + 3)
+ assertEquals(http2.options.take(3), newOptions)
+ assertEquals(origOptions.length, origOptionsLength)
+ }
+
+ @Test
+ def lastTimeoutValueShouldWin: Unit = {
+ val getFunc: HttpExec = (req,conn) => {
+
+ }
+ val r = Request(getFunc, Http.noopHttpUrl("http://localhost"), "GET").options(HttpOptions.connTimeout(1234)).options(HttpOptions.readTimeout(1234))
+ r.process(c => {
+ assertEquals(c.getReadTimeout, 1234)
+ assertEquals(c.getConnectTimeout, 1234)
+ })
+ }
+
+
+}
View
23 src/test/scala/scalaj/http/OAuthSpec.scala
@@ -1,23 +0,0 @@
-package scalaj.http
-
-import org.specs._
-
-class OAuthSpec extends Specification {
- "OAuth" should {
- "oauth sign correctly from example http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signing-requests/" in {
- val params = List(
- ("oauth_nonce","kllo9940pd9333jh"),
- ("oauth_timestamp","1191242096")
- )
-
- val url = "http://photos.example.net/photos"
- val req = Http(url).param("file", "vacation.jpg").param("size", "original")
-
- val (oauthParams, signature) = OAuth.getSig(params, req, Token("dpf43f3p2l4k3l03","kd94hf93k423kf44"), Some(Token("nnch734d00sl2jdk","pfkkdhi9sl3r4s00")),None)
-
- signature must_== "tR3+Ty81lMeYAr/Fid0kMTYa/WM="
- }
- }
-
-
-}
View
23 src/test/scala/scalaj/http/OAuthTest.scala
@@ -0,0 +1,23 @@
+package scalaj.http
+
+import org.junit.Assert._
+import org.junit.Test
+
+class OAuthTest {
+
+ @Test
+ def oauthShoulCorrectlySign: Unit = {
+ // from example http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signing-requests/
+ val params = List(
+ ("oauth_nonce","kllo9940pd9333jh"),
+ ("oauth_timestamp","1191242096")
+ )
+
+ val url = "http://photos.example.net/photos"
+ val req = Http(url).param("file", "vacation.jpg").param("size", "original")
+
+ val (oauthParams, signature) = OAuth.getSig(params, req, Token("dpf43f3p2l4k3l03","kd94hf93k423kf44"), Some(Token("nnch734d00sl2jdk","pfkkdhi9sl3r4s00")),None)
+
+ assertEquals(signature, "tR3+Ty81lMeYAr/Fid0kMTYa/WM=")
+ }
+}

0 comments on commit 2c7dc5e

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