spec/flipper/ui/actions/groups_gate_spec.rb in flipper-ui-0.21.0 vs spec/flipper/ui/actions/groups_gate_spec.rb in flipper-ui-0.22.0
- old
+ new
@@ -58,10 +58,27 @@
it 'redirects back to feature' do
expect(last_response.status).to be(302)
expect(last_response.headers['Location']).to eq('/features/search')
end
+ context 'feature name contains space' do
+ before do
+ post 'features/sp%20ace/groups',
+ { 'value' => group_name, 'operation' => 'enable', 'authenticity_token' => token },
+ 'rack.session' => session
+ end
+
+ it 'adds item to members' do
+ expect(flipper["sp ace"].groups_value).to include('admins')
+ end
+
+ it 'redirects back to feature' do
+ expect(last_response.status).to be(302)
+ expect(last_response.headers['Location']).to eq('/features/sp%20ace')
+ end
+ end
+
context 'group name contains whitespace' do
let(:group_name) { ' admins ' }
it 'adds item without whitespace' do
expect(flipper[:search].groups_value).to include('admins')
@@ -72,28 +89,28 @@
context 'unknown group name' do
let(:group_name) { 'not_here' }
it 'redirects back to feature' do
expect(last_response.status).to be(302)
- expect(last_response.headers['Location']).to eq('/features/search/groups?error=The+group+named+%22not_here%22+has+not+been+registered.')
+ expect(last_response.headers['Location']).to eq('/features/search/groups?error=The%20group%20named%20%22not_here%22%20has%20not%20been%20registered.')
end
end
context 'empty group name' do
let(:group_name) { '' }
it 'redirects back to feature' do
expect(last_response.status).to be(302)
- expect(last_response.headers['Location']).to eq('/features/search/groups?error=The+group+named+%22%22+has+not+been+registered.')
+ expect(last_response.headers['Location']).to eq('/features/search/groups?error=The%20group%20named%20%22%22%20has%20not%20been%20registered.')
end
end
context 'nil group name' do
let(:group_name) { nil }
it 'redirects back to feature' do
expect(last_response.status).to be(302)
- expect(last_response.headers['Location']).to eq('/features/search/groups?error=The+group+named+%22%22+has+not+been+registered.')
+ expect(last_response.headers['Location']).to eq('/features/search/groups?error=The%20group%20named%20%22%22%20has%20not%20been%20registered.')
end
end
end
end