Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a question method to determine environment. eg Merb.env?(:produc…
…tion)
- Loading branch information
Daniel Neighman
committed
Apr 25, 2008
1 parent
dfecddf
commit 4bb3861
Showing
2 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper") | ||
|
||
describe "Merb.env helpers" do | ||
before(:all) do | ||
@orig_env = Merb.environment | ||
end | ||
after(:all) do | ||
Merb.environment = @orig_env | ||
end | ||
|
||
it "should pickup the environment from env" do | ||
%w(development test production staging demo).each do |e| | ||
Merb.environment = e | ||
Merb.env.should == e | ||
end | ||
end | ||
|
||
it "should correctly answer the question about which env it's in with symbol or string" do | ||
%w(development test production staging demo custom).each do |e| | ||
Merb.environment = e | ||
Merb.env?(e).should be true | ||
Merb.env?(e.to_sym).should be_true | ||
end | ||
end | ||
|
||
it "should answer false if asked for an environment that is not current" do | ||
%w(development test production staging demo custom).each do |e| | ||
Merb.environment = e | ||
Merb.env?(:not_it).should be_false | ||
end | ||
end | ||
|
||
|
||
end |