- token = create(:oauth_access_token, :user => user)
- ability = ApiAbility.new user, token
+ scopes = Set.new
+ ability = ApiAbility.new user, scopes
[:create, :destroy, :restore].each do |action|
assert ability.cannot? action, ChangesetComment
end
end
[:create, :destroy, :restore].each do |action|
assert ability.cannot? action, ChangesetComment
end
end
- token = create(:oauth_access_token, :user => user, :scopes => %w[write_api])
- ability = ApiAbility.new user, token
+ scopes = Set.new %w[write_changeset_comments]
+ ability = ApiAbility.new user, scopes
[:destroy, :restore].each do |action|
assert ability.cannot? action, ChangesetComment
[:destroy, :restore].each do |action|
assert ability.cannot? action, ChangesetComment
- token = create(:oauth_access_token, :user => user)
- ability = ApiAbility.new user, token
+ scopes = Set.new
+ ability = ApiAbility.new user, scopes
[:create, :destroy, :restore].each do |action|
assert ability.cannot? action, ChangesetComment
end
end
[:create, :destroy, :restore].each do |action|
assert ability.cannot? action, ChangesetComment
end
end
- token = create(:oauth_access_token, :user => user, :scopes => %w[write_api])
- ability = ApiAbility.new user, token
+ scopes = Set.new %w[write_changeset_comments]
+ ability = ApiAbility.new user, scopes
[:create, :destroy, :restore].each do |action|
assert ability.can? action, ChangesetComment
[:create, :destroy, :restore].each do |action|
assert ability.can? action, ChangesetComment
- token = create(:oauth_access_token, :user => user)
- ability = ApiAbility.new user, token
+ scopes = Set.new
+ ability = ApiAbility.new user, scopes
[:create, :comment, :close, :reopen, :destroy].each do |action|
assert ability.cannot? action, Note
end
end
[:create, :comment, :close, :reopen, :destroy].each do |action|
assert ability.cannot? action, Note
end
end
- token = create(:oauth_access_token, :user => user, :scopes => %w[write_notes])
- ability = ApiAbility.new user, token
+ scopes = Set.new %w[write_notes]
+ ability = ApiAbility.new user, scopes
[:destroy].each do |action|
assert ability.cannot? action, Note
[:destroy].each do |action|
assert ability.cannot? action, Note
- token = create(:oauth_access_token, :user => user)
- ability = ApiAbility.new user, token
+ scopes = Set.new
+ ability = ApiAbility.new user, scopes
[:destroy].each do |action|
assert ability.cannot? action, Note
end
end
[:destroy].each do |action|
assert ability.cannot? action, Note
end
end
- token = create(:oauth_access_token, :user => user, :scopes => %w[write_notes])
- ability = ApiAbility.new user, token
+ scopes = Set.new %w[write_notes]
+ ability = ApiAbility.new user, scopes
[:destroy].each do |action|
assert ability.can? action, Note
[:destroy].each do |action|
assert ability.can? action, Note
- token = create(:oauth_access_token, :user => user)
- ability = ApiAbility.new user, token
+ scopes = Set.new
+ ability = ApiAbility.new user, scopes
[:index, :show, :update_all, :update, :destroy].each do |act|
assert ability.cannot? act, UserPreference
end
[:index, :show, :update_all, :update, :destroy].each do |act|
assert ability.cannot? act, UserPreference
end
- token = create(:oauth_access_token, :user => user, :scopes => %w[read_prefs])
- ability = ApiAbility.new user, token
+ scopes = Set.new %w[read_prefs]
+ ability = ApiAbility.new user, scopes
[:update_all, :update, :destroy].each do |act|
assert ability.cannot? act, UserPreference
[:update_all, :update, :destroy].each do |act|
assert ability.cannot? act, UserPreference
- token = create(:oauth_access_token, :user => user, :scopes => %w[write_prefs])
- ability = ApiAbility.new user, token
+ scopes = Set.new %w[write_prefs]
+ ability = ApiAbility.new user, scopes
[:index, :show].each do |act|
assert ability.cannot? act, UserPreference
[:index, :show].each do |act|
assert ability.cannot? act, UserPreference