mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-10 21:26:07 +10:00
Add audit events feature spec for project.
This commit is contained in:
@@ -8,11 +8,11 @@ class AuditEventsController < ApplicationController
|
||||
layout :determine_layout
|
||||
|
||||
def project_log
|
||||
@events = AuditEvent.where(entity_type: "Project", entity_id: project.id).page(params[:page]).per(30)
|
||||
@events = AuditEvent.where(entity_type: "Project", entity_id: project.id).page(params[:page]).per(20)
|
||||
end
|
||||
|
||||
def group_log
|
||||
@events = AuditEvent.where(entity_type: "Group", entity_id: group.id).page(params[:page]).per(30)
|
||||
@events = AuditEvent.where(entity_type: "Group", entity_id: group.id).page(params[:page]).per(20)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
%h3.page-title Group Audit Events
|
||||
%p.light Events in #{@group.name}
|
||||
|
||||
%table.table
|
||||
%table.table#audits
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
%h3.page-title Project Audit Events
|
||||
%p.light Events in #{@project.path_with_namespace}
|
||||
|
||||
%table.table
|
||||
%table.table#audits
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
|
||||
@@ -49,3 +49,14 @@ Feature: Project
|
||||
Then I should see project "Forum" README
|
||||
And I visit project "Shop" page
|
||||
Then I should see project "Shop" README
|
||||
|
||||
@javascript
|
||||
Scenario: I should see audit events
|
||||
And gitlab user "Pete"
|
||||
And "Pete" is "Shop" developer
|
||||
When I visit project "Shop" settings page
|
||||
And I go to "Members"
|
||||
Then I change "Pete" access level to master
|
||||
And I visit project "Shop" settings page
|
||||
And I go to "Audit Events"
|
||||
Then I should see the audit event listed
|
||||
|
||||
@@ -2,6 +2,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
|
||||
include SharedAuthentication
|
||||
include SharedProject
|
||||
include SharedPaths
|
||||
include Select2Helper
|
||||
|
||||
step 'change project settings' do
|
||||
fill_in 'project_name_edit', with: 'NewName'
|
||||
@@ -69,4 +70,47 @@ class Spinach::Features::Project < Spinach::FeatureSteps
|
||||
page.should have_link "README.md"
|
||||
page.should have_content "testme"
|
||||
end
|
||||
|
||||
step 'gitlab user "Pete"' do
|
||||
create(:user, name: "Pete")
|
||||
end
|
||||
|
||||
step '"Pete" is "Shop" developer' do
|
||||
user = User.find_by(name: "Pete")
|
||||
project = Project.find_by(name: "Shop")
|
||||
project.team << [user, :developer]
|
||||
end
|
||||
|
||||
step 'I visit project "Shop" settings page' do
|
||||
click_link 'Settings'
|
||||
end
|
||||
|
||||
step 'I go to "Members"' do
|
||||
click_link 'Members'
|
||||
end
|
||||
|
||||
step 'I change "Pete" access level to master' do
|
||||
user = User.find_by(name: "Pete")
|
||||
within "#user_#{user.id}" do
|
||||
select "Master", from: "project_member_access_level"
|
||||
end
|
||||
end
|
||||
|
||||
step 'I go to "Audit Events"' do
|
||||
click_link 'Audit Events'
|
||||
end
|
||||
|
||||
step 'I should see the audit event listed' do
|
||||
within ('table#audits tr:nth-child(1) td:nth-child(6)') do
|
||||
page.should have_content "Change access level from developer to master"
|
||||
end
|
||||
|
||||
within ('table#audits tr:nth-child(1) td:nth-child(3)') do
|
||||
page.should have_content project.owner.name
|
||||
end
|
||||
|
||||
within ('table#audits tr:nth-child(1) td:nth-child(8)') do
|
||||
page.should have_content 'Pete'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user