Commit f90db27e authored by Marin Jankovski's avatar Marin Jankovski

Add audit events feature spec for project.

parent e348c651
...@@ -8,11 +8,11 @@ class AuditEventsController < ApplicationController ...@@ -8,11 +8,11 @@ class AuditEventsController < ApplicationController
layout :determine_layout layout :determine_layout
def project_log 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 end
def group_log 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 end
private private
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%h3.page-title Group Audit Events %h3.page-title Group Audit Events
%p.light Events in #{@group.name} %p.light Events in #{@group.name}
%table.table %table.table#audits
%thead %thead
%tr %tr
%th %th
......
%h3.page-title Project Audit Events %h3.page-title Project Audit Events
%p.light Events in #{@project.path_with_namespace} %p.light Events in #{@project.path_with_namespace}
%table.table %table.table#audits
%thead %thead
%tr %tr
%th %th
......
...@@ -49,3 +49,14 @@ Feature: Project ...@@ -49,3 +49,14 @@ Feature: Project
Then I should see project "Forum" README Then I should see project "Forum" README
And I visit project "Shop" page And I visit project "Shop" page
Then I should see project "Shop" README 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 ...@@ -2,6 +2,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedProject include SharedProject
include SharedPaths include SharedPaths
include Select2Helper
step 'change project settings' do step 'change project settings' do
fill_in 'project_name_edit', with: 'NewName' fill_in 'project_name_edit', with: 'NewName'
...@@ -69,4 +70,47 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -69,4 +70,47 @@ class Spinach::Features::Project < Spinach::FeatureSteps
page.should have_link "README.md" page.should have_link "README.md"
page.should have_content "testme" page.should have_content "testme"
end 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment