-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat non
{test,development}
envs as production
Closes [#361]. When the Rails environment is neither `test` nor `development` ([two environments handled by EmberCLI out-of-the-box][ember-cli-env]), treat it as `production`. [#361]: #361 [ember-cli-env]: http://ember-cli.com/user-guide/#Environments
- Loading branch information
1 parent
b85bd02
commit 219f546
Showing
3 changed files
with
49 additions
and
19 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
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,41 @@ | ||
require "ember_cli/helpers" | ||
|
||
describe EmberCli::Helpers do | ||
describe ".current_environment" do | ||
context "when test" do | ||
it "returns test" do | ||
stub_rails_env("test") | ||
|
||
current_environment = EmberCli::Helpers.current_environment | ||
|
||
expect(current_environment).to be_test | ||
end | ||
end | ||
|
||
context "when development" do | ||
it "returns development" do | ||
stub_rails_env("development") | ||
|
||
current_environment = EmberCli::Helpers.current_environment | ||
|
||
expect(current_environment).to be_development | ||
end | ||
end | ||
|
||
context "when anything else" do | ||
it "returns production" do | ||
stub_rails_env("staging") | ||
|
||
current_environment = EmberCli::Helpers.current_environment | ||
|
||
expect(current_environment).to be_production | ||
end | ||
end | ||
end | ||
|
||
def stub_rails_env(env) | ||
allow(Rails). | ||
to receive(:env). | ||
and_return(env.to_s.inquiry) | ||
end | ||
end |