Skip to content

Commit

Permalink
Merge pull request skinny-framework#251 from tsukaby/feature/fix_env_…
Browse files Browse the repository at this point in the history
…handling

Fix env handling.
  • Loading branch information
seratch committed Apr 4, 2015
2 parents a8178d2 + 4575ab4 commit 99635ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ trait EnvFeature extends ScalatraBase {
*
* @return env string such as "production"
*/
def skinnyEnv: Option[String] = SkinnyEnv.get().orElse(Option(environment))

def skinnyEnv: Option[String] = SkinnyEnv.get().orElse {
// convert upper cased "org.scalatra.environment" (e.g. DEVELOPMENT) to skinny's style here
Option(environment).map(_.toLowerCase(java.util.Locale.ENGLISH))
}
/**
* Predicates current env is "development" or "dev".
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ class EnvFeatureSpec extends FlatSpec with Matchers {
}
}

it should "convert the default value of Scalatra's environment to lower cased one" in {
class Controller extends SkinnyApiController {
skinnyEnv should equal(Some("development"))
}
}

}

0 comments on commit 99635ba

Please sign in to comment.