diff --git a/app/views/country_states/index.html.erb b/app/views/country_states/index.html.erb
index 5fcfa75..7f09de8 100644
--- a/app/views/country_states/index.html.erb
+++ b/app/views/country_states/index.html.erb
@@ -16,7 +16,8 @@
<% if policy(country_state).show? %>
<%= link_to country_state,
- role: :button, class: 'btn btn-light btn-sm' do %>
+ role: :button,
+ class: 'btn btn-light btn-sm' do %>
<% end %>
<% end %>
diff --git a/app/views/settings/roles/index.html.erb b/app/views/settings/roles/index.html.erb
index 6d3783a..c93e46f 100644
--- a/app/views/settings/roles/index.html.erb
+++ b/app/views/settings/roles/index.html.erb
@@ -27,7 +27,17 @@
| <%= role.id %> |
<%= role.human_name %> |
<%= role.human_resource %> |
- |
+
+ <% if policy([:settings, role]).destroy? %>
+ <%= link_to [:settings, role],
+ method: :delete,
+ role: :button,
+ class: 'btn btn-danger btn-sm' do %>
+
+ <%= translate '.revoke' %>
+ <% end %>
+ <% end %>
+ |
<% end %>
diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml
index 9490565..5bbd771 100644
--- a/config/locales/views/en.yml
+++ b/config/locales/views/en.yml
@@ -45,3 +45,7 @@ en:
index:
new_confirmation: New confirmation
already_confirmed: You have already confirmed the passport.
+ settings:
+ roles:
+ index:
+ revoke: Revoke
diff --git a/config/locales/views/ru.yml b/config/locales/views/ru.yml
index b098eb0..98a94b0 100644
--- a/config/locales/views/ru.yml
+++ b/config/locales/views/ru.yml
@@ -46,3 +46,7 @@ ru:
index:
new_confirmation: Новое подтверждение
already_confirmed: Вы уже подтвердили этот паспорт.
+ settings:
+ roles:
+ index:
+ revoke: Отозвать
diff --git a/features/desktop/settings/roles.feature b/features/desktop/settings/roles.feature
new file mode 100644
index 0000000..c367752
--- /dev/null
+++ b/features/desktop/settings/roles.feature
@@ -0,0 +1,10 @@
+Feature: Roles
+ Background:
+ Given I am signed in as superuser
+
+ Scenario:
+ When I visit "/settings/roles"
+ Then I see text "Суперпользователь"
+
+ When I click the button "Отозвать"
+ Then I do not see text "Суперпользователь"
diff --git a/features/step_definitions/user.rb b/features/step_definitions/user.rb
index b54be7a..a13d2da 100644
--- a/features/step_definitions/user.rb
+++ b/features/step_definitions/user.rb
@@ -9,6 +9,21 @@ Given 'I am signed in as guest' do
visit root_path guest_token: account.guest_token
end
+Given 'I am signed in as superuser' do
+ account = create :superuser_account
+
+ visit '/users/sign_in'
+
+ within 'form' do
+ fill_in 'Email', with: account.user.email
+ fill_in 'Пароль', with: account.user.password
+
+ click_on 'Войти'
+ end
+
+ expect(page).to have_css 'ul > li > a', text: account.user.account.username
+end
+
Given 'I am signed in with email {string}' do |email|
@user = create :user, email: email