extend-roles-api-fields_v2.patch

Alex Stanev, 2018-02-28 19:17

Download (1.29 KB)

View differences:

app/views/roles/show.api.rsb
1 1
api.role do
2 2
  api.id @role.id
3 3
  api.name @role.name
4
  api.assignable @role.assignable
5
  api.issues_visibility @role.issues_visibility
6
  api.time_entries_visibility @role.time_entries_visibility
7
  api.users_visibility @role.users_visibility
4 8
  api.array :permissions do
5 9
    @role.permissions.each do |perm|
6 10
      api.permission(perm.to_s)
test/integration/api_test/roles_test.rb
53 53

  
54 54
    assert_select 'role' do
55 55
      assert_select 'name', :text => 'Manager'
56
      assert_select 'assignable', :text => 'true'
57
      assert_select 'issues_visibility', :text => 'all'
58
      assert_select 'time_entries_visibility', :text => 'all'
59
      assert_select 'users_visibility', :text => 'all'
60

  
56 61
      assert_select 'role permissions[type=array]' do
57 62
        assert_select 'permission', Role.find(1).permissions.size
58 63
        assert_select 'permission', :text => 'view_issues'