|
49 | 49 |
|
50 | 50 | assert_equal "deployment", config.rack_env |
51 | 51 | end |
52 | | - |
53 | | - context "when legacy PLINY_ENV is still defined" do |
54 | | - before do |
55 | | - ENV["ORIGINAL_PLINY_ENV"] = ENV["PLINY_ENV"] |
56 | | - ENV["PLINY_ENV"] = "staging" |
57 | | - end |
58 | | - |
59 | | - after do |
60 | | - ENV["PLINY_ENV"] = ENV.delete("ORIGINAL_PLINY_ENV") |
61 | | - end |
62 | | - |
63 | | - it "uses PLINY_ENV value instead of APP_ENV" do |
64 | | - config = Class.new do |
65 | | - extend Pliny::CastingConfigHelpers |
66 | | - override :app_env, "development", string |
67 | | - end |
68 | | - |
69 | | - assert_equal "deployment", config.rack_env |
70 | | - end |
71 | | - |
72 | | - it "displays deprecation warning" do |
73 | | - config = Class.new do |
74 | | - extend Pliny::CastingConfigHelpers |
75 | | - override :app_env, "development", string |
76 | | - end |
77 | | - |
78 | | - io = StringIO.new |
79 | | - $stderr = io |
80 | | - config.rack_env |
81 | | - $stderr = STDERR |
82 | | - |
83 | | - assert_includes io.string, "PLINY_ENV is deprecated" |
84 | | - end |
85 | | - end |
86 | | - end |
87 | | - |
88 | | - describe "#pliny_env" do |
89 | | - it "displays deprecation warning if pliny_env is used" do |
90 | | - config = Class.new do |
91 | | - extend Pliny::CastingConfigHelpers |
92 | | - override :app_env, "development", string |
93 | | - end |
94 | | - |
95 | | - io = StringIO.new |
96 | | - $stderr = io |
97 | | - config.pliny_env |
98 | | - $stderr = STDERR |
99 | | - |
100 | | - assert_includes io.string, "Config.pliny_env is deprecated" |
101 | | - end |
102 | | - |
103 | | - it "returns app_env value" do |
104 | | - config = Class.new do |
105 | | - extend Pliny::CastingConfigHelpers |
106 | | - override :app_env, "foo", string |
107 | | - end |
108 | | - |
109 | | - assert_equal "foo", config.pliny_env |
110 | | - end |
111 | | - |
112 | | - context "when legacy PLINY_ENV is still defined" do |
113 | | - before do |
114 | | - ENV["ORIGINAL_PLINY_ENV"] = ENV["PLINY_ENV"] |
115 | | - ENV["PLINY_ENV"] = "staging" |
116 | | - end |
117 | | - |
118 | | - after do |
119 | | - ENV["PLINY_ENV"] = ENV.delete("ORIGINAL_PLINY_ENV") |
120 | | - end |
121 | | - |
122 | | - it "returns PLINY_ENV value" do |
123 | | - config = Class.new do |
124 | | - extend Pliny::CastingConfigHelpers |
125 | | - override :app_env, "development", string |
126 | | - end |
127 | | - |
128 | | - assert_equal "staging", config.pliny_env |
129 | | - end |
130 | | - end |
131 | 52 | end |
132 | 53 | end |
0 commit comments