-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
require "minitest/autorun" | ||
require "minitest/pride" | ||
|
||
require_relative "ex07" | ||
|
||
class Ex07MyAppTest < Minitest::Test | ||
Module.prepend MyApp | ||
def test_class_config | ||
skip | ||
s = MyApp.config | ||
assert_equal s.class, MyApp::Config | ||
MyApp.reset | ||
end | ||
|
||
def test_obj_id | ||
skip | ||
a = MyApp.config | ||
b = MyApp.config | ||
assert_equal a.object_id, b.object_id | ||
MyApp.reset | ||
end | ||
|
||
def test_default_env | ||
skip | ||
a = MyApp.config | ||
assert_equal a.app_name, "dev app" | ||
MyApp.reset | ||
end | ||
|
||
def test_env_production | ||
skip | ||
ENV["MY_APP_ENV"] = "production" | ||
assert_equal MyApp.config.server, "http://httpd.example.org/" | ||
MyApp.reset | ||
end | ||
|
||
def test_nested_level_one | ||
skip | ||
ENV["MY_APP_ENV"] = "test" | ||
assert_equal MyApp.config.public.mode, "public" | ||
MyApp.reset | ||
end | ||
|
||
def test_nested_level_two | ||
skip | ||
ENV["MY_APP_ENV"] = "test" | ||
assert_equal MyApp.config.private.private.login, "[email protected]" | ||
MyApp.reset | ||
end | ||
|
||
def test_erb_default | ||
skip | ||
ENV["MY_APP_ENV"] = "test" | ||
assert_equal MyApp.config.database.user, "root" | ||
MyApp.reset | ||
end | ||
|
||
def test_erb_specified | ||
skip | ||
ENV["DATABASE_USER"] = "admin" | ||
assert_equal MyApp.config.database.user, "admin" | ||
MyApp.reset | ||
end | ||
end |