Created
May 16, 2017 10:46
-
-
Save jeffreyolchovy/7cef6863db768c9ea61d1850b7596407 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package sbttweeter | |
| import sbt._ | |
| import sbt.Keys._ | |
| object TweeterKeys { | |
| /* Instantiate your setting, task, and input task keys here */ | |
| } | |
| object TweeterPlugin extends AutoPlugin { | |
| object autoImport { | |
| /* Whatever you want brought into scope automatically for users of your plugin */ | |
| val TweeterKeys = sbttweeter.TweeterKeys | |
| } | |
| override def projectSettings = Seq( | |
| /* Whatever settings/behavior you want to make available to the project that includes your plugin */ | |
| ) | |
| } |
This file contains hidden or 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
| package com.example.sbt | |
| import scala.util.Try | |
| trait TweeterService { | |
| def post(tweet: String): Try[_] | |
| } |
This file contains hidden or 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
| package com.example.sbt | |
| import scala.util.Failure | |
| import org.scalatest.{FlatSpec, Matchers} | |
| class TweeterServiceSpec extends FlatSpec with Matchers { | |
| behavior of "TweeterService" | |
| it should "return a failure when ..." in { | |
| pending | |
| val service: TweeterService = ??? | |
| val result = service.post("This tweet should never make it out!") | |
| result shouldBe a[Failure[_]] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment