@@ -18,6 +18,18 @@ defmodule FunWithFlags.UI.RouterTest do
18
18
19
19
@ opts Router . init ( [ ] )
20
20
21
+ describe "script_name" do
22
+ test "redirects to /flags" do
23
+ conn =
24
+ conn ( :get , "/" )
25
+ |> Map . put ( :script_name , [ "pear" ] )
26
+ |> Router . call ( @ opts )
27
+
28
+ assert 302 = conn . status
29
+ assert [ "/pear/flags" ] = get_resp_header ( conn , "location" )
30
+ end
31
+ end
32
+
21
33
describe "GET /" do
22
34
test "redirects to /flags" do
23
35
conn = request! ( :get , "/" )
@@ -112,7 +124,7 @@ defmodule FunWithFlags.UI.RouterTest do
112
124
describe "DELETE /flags/:name/boolean" do
113
125
test "when the flag exists, it deletes its boolean gate and redirects to the flag page" do
114
126
{ :ok , true } = FunWithFlags . enable :frozen_yogurt
115
- { :ok , true } = FunWithFlags . enable :frozen_yogurt , for_group: "some_group"
127
+ { :ok , true } = FunWithFlags . enable :frozen_yogurt , for_group: "some_group"
116
128
117
129
assert % Flag { name: :frozen_yogurt , gates: [ % Gate { type: :boolean } , % Gate { type: :group } ] } = FunWithFlags . get_flag ( :frozen_yogurt )
118
130
@@ -128,7 +140,7 @@ defmodule FunWithFlags.UI.RouterTest do
128
140
describe "DELETE /flags/:name/percentage" do
129
141
test "when the flag exists, it deletes its current percentage gate and redirects to the flag page" do
130
142
{ :ok , true } = FunWithFlags . enable :pizza , for_percentage_of: { :time , 0.5 }
131
- { :ok , true } = FunWithFlags . enable :pizza , for_group: "some_group"
143
+ { :ok , true } = FunWithFlags . enable :pizza , for_group: "some_group"
132
144
133
145
assert % Flag { name: :pizza , gates: [ % Gate { type: :percentage_of_time , for: 0.5 } , % Gate { type: :group } ] } = FunWithFlags . get_flag ( :pizza )
134
146
0 commit comments