Merge commit 'master' into discussions

Conflicts:
	app/assets/stylesheets/sections/notes.scss
	app/contexts/notes/load_context.rb
	app/models/project.rb
	app/observers/note_observer.rb
	app/roles/votes.rb
	app/views/commit/show.html.haml
	app/views/merge_requests/_show.html.haml
	app/views/merge_requests/diffs.js.haml
	app/views/merge_requests/show.js.haml
	app/views/notes/_note.html.haml
	features/steps/project/project_merge_requests.rb
	spec/models/note_spec.rb
This commit is contained in:
Riyad Preukschas 2013-01-15 00:52:25 +01:00
commit 3022786948
930 changed files with 80374 additions and 103682 deletions

View file

@ -1,6 +1,8 @@
Feature: Admin Groups
Background:
Given I sign in as an admin
And I have group with projects
And Create gitlab user "John"
And I visit admin groups page
Scenario: Create a group
@ -8,3 +10,8 @@ Feature: Admin Groups
And submit form with new group info
Then I should be redirected to group page
And I should see newly created group
Scenario: Add user into projects in group
When I visit admin group page
When I select user "John" from user list as "Reporter"
Then I should see "John" in team list in every project as "Reporter"

View file

@ -0,0 +1,7 @@
Feature: Admin Logs
Background:
Given I sign in as an admin
Scenario: On Admin Logs
Given I visit admin logs page
Then I should see tabs with available logs

View file

@ -0,0 +1,13 @@
Feature: Admin Projects
Background:
Given I sign in as an admin
And there are projects in system
Scenario: Projects list
When I visit admin projects page
Then I should see all projects
Scenario: Projects show
When I visit admin projects page
And I click on first project
Then I should see project details

View file

@ -0,0 +1,8 @@
Feature: Admin Users
Background:
Given I sign in as an admin
And system has users
Scenario: On Admin Users
Given I visit admin users page
Then I should see all users

View file

@ -5,6 +5,7 @@ Feature: Dashboard
And project "Shop" has push event
And I visit dashboard page
@javascript
Scenario: I should see projects list
Then I should see "New Project" link
Then I should see "Shop" project link
@ -26,11 +27,13 @@ Feature: Dashboard
And I click "Create Merge Request" link
Then I see prefilled new Merge Request page
@javascript
Scenario: I should see User joined Project event
Given user with name "John Doe" joined project "Shop"
When I visit dashboard page
Then I should see "John Doe joined project at Shop" event
@javascript
Scenario: I should see User left Project event
Given user with name "John Doe" joined project "Shop"
And user with name "John Doe" left project "Shop"

View file

@ -0,0 +1,51 @@
Feature: Event filters
Background:
Given I sign in as a user
And I own a project
And this project has push event
And this project has new member event
And this project has merge request event
And I visit dashboard page
@javascript
Scenario: I should see all events
Then I should see push event
And I should see new member event
And I should see merge request event
@javascript
Scenario: I should see only pushed events
When I click "push" event filter
Then I should see push event
And I should not see new member event
And I should not see merge request event
@javascript
Scenario: I should see only joined events
When I click "team" event filter
Then I should see new member event
And I should not see push event
And I should not see merge request event
@javascript
Scenario: I should see only merged events
When I click "merge" event filter
Then I should see merge request event
And I should not see push event
And I should not see new member event
@javascript
Scenario: I should see only selected events while page reloaded
When I click "push" event filter
And I visit dashboard page
Then I should see push event
And I should not see new member event
When I click "team" event filter
And I visit dashboard page
Then I should see push event
And I should see new member event
And I should not see merge request event
When I click "push" event filter
Then I should not see push event
And I should see new member event
And I should not see merge request event

View file

@ -3,6 +3,7 @@ Feature: Groups
Given I sign in as a user
And I have group with projects
@javascript
Scenario: I should see group dashboard list
When I visit group page
Then I should see projects list
@ -17,3 +18,9 @@ Feature: Groups
Given project from group has merge requests assigned to me
When I visit group merge requests page
Then I should see merge requests from this group assigned to me
Scenario: I should add user to projects in Group
Given I have new user "John"
When I visit group people page
And I select user "John" from list with role "Reporter"
Then I should see user "John" in team list

View file

@ -1,14 +1,23 @@
Feature: Projects
Background:
Given I signin as a user
Given I sign in as a user
And I own project "Shop"
And project "Shop" has push event
And I visit project "Shop" page
# @wip
# Scenario: I should see project activity
Scenario: I should see project activity
When I visit project "Shop" page
Then I should see project "Shop" activity feed
# @wip
# Scenario: I edit project
Scenario: I visit edit project
When I visit edit project "Shop" page
Then I should see project settings
Scenario: I edit project
When I visit edit project "Shop" page
And change project settings
And I save project
Then I should see project with new settings
# @wip
# Scenario: I visit attachments

View file

@ -0,0 +1,14 @@
Feature: Project Services
Background:
Given I sign in as a user
And I own project "Shop"
Scenario: I should see project services
When I visit project "Shop" services page
Then I should see list of available services
Scenario: Activate gitlab-ci service
When I visit project "Shop" services page
And I click gitlab-ci service link
And I fill gitlab-ci settings
Then I should see service settings saved

View file

@ -28,6 +28,6 @@ class AdminActiveTab < Spinach::FeatureSteps
end
Then 'the active main tab should be Resque' do
ensure_active_main_tab('Resque')
ensure_active_main_tab('Background Jobs')
end
end

View file

@ -3,10 +3,26 @@ class AdminGroups < Spinach::FeatureSteps
include SharedPaths
include SharedActiveTab
When 'I visit admin group page' do
visit admin_group_path(current_group)
end
When 'I click new group link' do
click_link "New Group"
end
And 'I have group with projects' do
@group = create(:group)
@project = create(:project, group: @group)
@event = create(:closed_issue_event, project: @project)
@project.team << [current_user, :master]
end
And 'Create gitlab user "John"' do
create(:user, :name => "John")
end
And 'submit form with new group info' do
fill_in 'group_name', :with => 'gitlab'
click_button "Create group"
@ -19,5 +35,25 @@ class AdminGroups < Spinach::FeatureSteps
Then 'I should be redirected to group page' do
current_path.should == admin_group_path(Group.last)
end
end
When 'I select user "John" from user list as "Reporter"' do
user = User.find_by_name("John")
within "#new_team_member" do
select user.name, :from => "user_ids"
select "Reporter", :from => "project_access"
end
click_button "Add user to projects in group"
end
Then 'I should see "John" in team list in every project as "Reporter"' do
user = User.find_by_name("John")
projects_with_access = find(".user_#{user.id} .projects_access")
projects_with_access.should have_link("Reporter")
end
protected
def current_group
@group ||= Group.first
end
end

View file

@ -0,0 +1,11 @@
class AdminLogs < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedAdmin
Then 'I should see tabs with available logs' do
page.should have_content 'production.log'
page.should have_content 'githost.log'
page.should have_content 'application.log'
end
end

View file

@ -0,0 +1,24 @@
class AdminProjects < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedAdmin
And 'I should see all projects' do
Project.all.each do |p|
page.should have_content p.name_with_namespace
end
end
And 'I click on first project' do
click_link Project.first.name_with_namespace
end
Then 'I should see project details' do
project = Project.first
current_path.should == admin_project_path(project)
page.should have_content(project.name_with_namespace)
page.should have_content(project.creator.name)
page.should have_content('Add new team member')
end
end

View file

@ -0,0 +1,11 @@
class AdminUsers < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedAdmin
Then 'I should see all users' do
User.all.each do |user|
page.should have_content user.name
end
end
end

View file

@ -1,6 +1,7 @@
class Dashboard < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
Then 'I should see "New Project" link' do
page.should have_link "New Project"
@ -10,11 +11,6 @@ class Dashboard < Spinach::FeatureSteps
page.should have_link "Shop"
end
Then 'I should see project "Shop" activity feed' do
project = Project.find_by_name("Shop")
page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
end
Then 'I should see last push widget' do
page.should have_content "You pushed to new_design"
page.should have_link "Create Merge Request"
@ -59,43 +55,12 @@ class Dashboard < Spinach::FeatureSteps
page.should have_content "John Doe left project at Shop"
end
And 'I own project "Shop"' do
@project = create :project, name: 'Shop'
@project.add_access(@user, :admin)
end
And 'I have group with projects' do
@group = create(:group)
@project = create(:project, group: @group)
@event = create(:closed_issue_event, project: @project)
@project.add_access current_user, :admin
end
And 'project "Shop" has push event' do
@project = Project.find_by_name("Shop")
data = {
before: "0000000000000000000000000000000000000000",
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
ref: "refs/heads/new_design",
user_id: @user.id,
user_name: @user.name,
repository: {
name: @project.name,
url: "localhost/rubinius",
description: "",
homepage: "localhost/rubinius",
private: true
}
}
@event = Event.create(
project: @project,
action: Event::Pushed,
data: data,
author_id: @user.id
)
@project.team << [current_user, :master]
end
Then 'I should see groups list' do
@ -112,5 +77,4 @@ class Dashboard < Spinach::FeatureSteps
Then 'I should see 1 project at group list' do
page.find('span.last_activity/span').should have_content('1')
end
end

View file

@ -0,0 +1,87 @@
class EventFilters < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
Then 'I should see push event' do
page.should have_selector('span.pushed')
end
Then 'I should not see push event' do
page.should_not have_selector('span.pushed')
end
Then 'I should see new member event' do
page.should have_selector('span.joined')
end
And 'I should not see new member event' do
page.should_not have_selector('span.joined')
end
Then 'I should see merge request event' do
page.should have_selector('span.merged')
end
And 'I should not see merge request event' do
page.should_not have_selector('span.merged')
end
And 'this project has push event' do
data = {
before: "0000000000000000000000000000000000000000",
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
ref: "refs/heads/new_design",
user_id: @user.id,
user_name: @user.name,
repository: {
name: @project.name,
url: "localhost/rubinius",
description: "",
homepage: "localhost/rubinius",
private: true
}
}
@event = Event.create(
project: @project,
action: Event::Pushed,
data: data,
author_id: @user.id
)
end
And 'this project has new member event' do
user = create(:user, {name: "John Doe"})
Event.create(
project: @project,
author_id: user.id,
action: Event::Joined
)
end
And 'this project has merge request event' do
merge_request = create :merge_request, author: @user, project: @project
Event.create(
project: @project,
action: Event::Merged,
target_id: merge_request.id,
target_type: "MergeRequest",
author_id: @user.id
)
end
When 'I click "push" event filter' do
click_link("push_event_filter")
end
When 'I click "team" event filter' do
click_link("team_event_filter")
end
When 'I click "merge" event filter' do
click_link("merged_event_filter")
end
end

View file

@ -13,7 +13,7 @@ class DashboardIssues < Spinach::FeatureSteps
And 'I have assigned issues' do
project = create :project
project.add_access(@user, :read, :write)
project.team << [@user, :master]
2.times { create :issue, author: @user, assignee: @user, project: project }
end

View file

@ -14,8 +14,8 @@ class DashboardMergeRequests < Spinach::FeatureSteps
project1 = create :project
project2 = create :project
project1.add_access(@user, :read, :write)
project2.add_access(@user, :read, :write)
project1.team << [@user, :master]
project2.team << [@user, :master]
merge_request1 = create :merge_request, author: @user, project: project1
merge_request2 = create :merge_request, author: @user, project: project2

View file

@ -1,6 +1,7 @@
class DashboardSearch < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
Given 'I search for "Sho"' do
fill_in "dashboard_search", with: "Sho"
@ -11,11 +12,6 @@ class DashboardSearch < Spinach::FeatureSteps
page.should have_link "Shop"
end
And 'I own project "Shop"' do
@project = create(:project, :name => "Shop")
@project.add_access(@user, :admin)
end
Given 'I search for "Contibuting"' do
fill_in "dashboard_search", with: "Contibuting"
click_button "Search"

View file

@ -3,17 +3,17 @@ class Groups < Spinach::FeatureSteps
include SharedPaths
Then 'I should see projects list' do
current_user.projects.each do |project|
current_user.authorized_projects.each do |project|
page.should have_link project.name
end
end
And 'I have group with projects' do
@group = create(:group)
@group = create(:group, owner: current_user)
@project = create(:project, group: @group)
@event = create(:closed_issue_event, project: @project)
@project.add_access current_user, :admin
@project.team << [current_user, :master]
end
And 'I should see projects activity feed' do
@ -32,6 +32,24 @@ class Groups < Spinach::FeatureSteps
end
end
Given 'I have new user "John"' do
create(:user, name: "John")
end
And 'I select user "John" from list with role "Reporter"' do
user = User.find_by_name("John")
within "#new_team_member" do
select user.name, :from => "user_ids"
select "Reporter", :from => "project_access"
end
click_button "Add"
end
Then 'I should see user "John" in team list' do
projects_with_access = find(".ui-box .well-list")
projects_with_access.should have_content("John")
end
Given 'project from group has issues assigned to me' do
create :issue,
project: project,

View file

@ -3,13 +3,13 @@ class CreateProject < Spinach::FeatureSteps
include SharedPaths
And 'fill project form with valid data' do
fill_in 'project_name', :with => 'NewProject'
fill_in 'project_name', with: 'Empty'
click_button "Create project"
end
Then 'I should see project page' do
current_path.should == project_path(Project.last)
page.should have_content "NewProject"
page.should have_content "Empty"
end
And 'I should see empty project instuctions' do

View file

@ -2,4 +2,17 @@ class Projects < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
And 'change project settings' do
fill_in 'project_name', with: 'NewName'
uncheck 'project_issues_enabled'
end
And 'I save project' do
click_button 'Save'
end
Then 'I should see project with new settings' do
find_field('project_name').value.should == 'NewName'
end
end

View file

@ -4,7 +4,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
include SharedPaths
Then 'I see project commits' do
commit = @project.commit
commit = @project.repository.commit
page.should have_content(@project.name)
page.should have_content(commit.message)
page.should have_content(commit.id.to_s[0..5])
@ -15,7 +15,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
end
Then 'I see commits atom feed' do
commit = CommitDecorator.decorate(@project.commit)
commit = CommitDecorator.decorate(@project.repository.commit)
page.response_headers['Content-Type'].should have_content("application/atom+xml")
page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
page.body.should have_selector("author email", :text => commit.author_email)
@ -48,7 +48,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
page.should have_selector('ul.breadcrumb span.divider', count: 3)
page.should have_selector('ul.breadcrumb a', count: 4)
find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path}\/commits\/master\z/)
find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path_with_namespace}\/commits\/master\z/)
find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z})
end

View file

@ -56,10 +56,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
And 'I submit new merge request "Wiki Feature"' do
fill_in "merge_request_title", with: "Wiki Feature"
select "master", from: "merge_request_source_branch"
select "stable", from: "merge_request_target_branch"
click_button "Save"
fill_in "merge_request_title", :with => "Wiki Feature"
select "master", :from => "merge_request_source_branch"
select "stable", :from => "merge_request_target_branch"
click_button "Submit merge request"
end
And 'project "Shop" have "Bug NS-04" open merge request' do

View file

@ -50,12 +50,12 @@ class ProjectMilestones < Spinach::FeatureSteps
end
Then "I should see 3 issues" do
page.should have_selector('.milestone-issue-filter tbody tr', count: 4)
page.should have_selector('.milestone-issue-filter tbody tr.hide', count: 1)
page.should have_selector('.milestone-issue-filter .well-list li', count: 4)
page.should have_selector('.milestone-issue-filter .well-list li.hide', count: 1)
end
Then "I should see 4 issues" do
page.should have_selector('.milestone-issue-filter tbody tr', count: 4)
page.should_not have_selector('.milestone-issue-filter tbody tr.hide')
page.should have_selector('.milestone-issue-filter .well-list li', count: 4)
page.should_not have_selector('.milestone-issue-filter .well-list li.hide')
end
end

View file

@ -6,7 +6,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
page.should have_content "Project Network Graph"
within ".graph" do
page.should have_content "master"
page.should have_content "scss_refactor..."
end
end

View file

@ -0,0 +1,30 @@
class ProjectServices < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
When 'I visit project "Shop" services page' do
visit project_services_path(@project)
end
Then 'I should see list of available services' do
page.should have_content 'Services'
page.should have_content 'Jenkins'
page.should have_content 'GitLab CI'
end
And 'I click gitlab-ci service link' do
click_link 'GitLab CI'
end
And 'I fill gitlab-ci settings' do
check 'Active'
fill_in 'Project URL', with: 'http://ci.gitlab.org/projects/3'
fill_in 'CI Project token', with: 'verySecret'
click_button 'Save'
end
Then 'I should see service settings saved' do
find_field('Project URL').value.should == 'http://ci.gitlab.org/projects/3'
end
end

View file

@ -84,18 +84,18 @@ class ProjectTeamManagement < Spinach::FeatureSteps
And '"Sam" is "Shop" developer' do
user = User.find_by_name("Sam")
project = Project.find_by_name("Shop")
project.add_access(user, :write)
project.team << [user, :developer]
end
Given 'I own project "Website"' do
@project = create(:project, :name => "Website")
@project.add_access(@user, :admin)
@project.team << [@user, :master]
end
And '"Mike" is "Website" reporter' do
user = User.find_by_name("Mike")
project = Project.find_by_name("Website")
project.add_access(user, :read)
project.team << [user, :reporter]
end
And 'I click link "Import team from another project"' do

View file

@ -0,0 +1,12 @@
module SharedAdmin
include Spinach::DSL
And 'there are projects in system' do
2.times { create(:project) }
end
And 'system has users' do
2.times { create(:user) }
end
end

View file

@ -21,6 +21,10 @@ module SharedPaths
visit merge_requests_group_path(current_group)
end
When 'I visit group people page' do
visit people_group_path(current_group)
end
# ----------------------------------------
# Dashboard
# ----------------------------------------
@ -110,15 +114,15 @@ module SharedPaths
end
Given "I visit my project's files page" do
visit project_tree_path(@project, @project.root_ref)
visit project_tree_path(@project, root_ref)
end
Given "I visit my project's commits page" do
visit project_commits_path(@project, @project.root_ref, {limit: 5})
visit project_commits_path(@project, root_ref, {limit: 5})
end
Given "I visit my project's commits page for a specific path" do
visit project_commits_path(@project, @project.root_ref + "/app/models/project.rb", {limit: 5})
visit project_commits_path(@project, root_ref + "/app/models/project.rb", {limit: 5})
end
Given 'I visit my project\'s commits stats page' do
@ -161,6 +165,11 @@ module SharedPaths
visit project_path(project)
end
When 'I visit edit project "Shop" page' do
project = Project.find_by_name("Shop")
visit edit_project_path(project)
end
Given 'I visit project branches page' do
visit branches_project_repository_path(@project)
end
@ -170,7 +179,7 @@ module SharedPaths
end
Given 'I visit project commits page' do
visit project_commits_path(@project, @project.root_ref, {limit: 5})
visit project_commits_path(@project, root_ref, {limit: 5})
end
Given 'I visit project commits page for stable branch' do
@ -178,7 +187,7 @@ module SharedPaths
end
Given 'I visit project source page' do
visit project_tree_path(@project, @project.root_ref)
visit project_tree_path(@project, root_ref)
end
Given 'I visit blob file from repo' do
@ -241,4 +250,8 @@ module SharedPaths
Given 'I visit project wiki page' do
visit project_wiki_path(@project, :index)
end
def root_ref
@project.repository.root_ref
end
end

View file

@ -4,13 +4,51 @@ module SharedProject
# Create a project without caring about what it's called
And "I own a project" do
@project = create(:project)
@project.add_access(@user, :admin)
@project.team << [@user, :master]
end
# Create a specific project called "Shop"
And 'I own project "Shop"' do
@project = create(:project, :name => "Shop")
@project.add_access(@user, :admin)
@project = create(:project, name: "Shop")
@project.team << [@user, :master]
end
And 'project "Shop" has push event' do
@project = Project.find_by_name("Shop")
data = {
before: "0000000000000000000000000000000000000000",
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
ref: "refs/heads/new_design",
user_id: @user.id,
user_name: @user.name,
repository: {
name: @project.name,
url: "localhost/rubinius",
description: "",
homepage: "localhost/rubinius",
private: true
}
}
@event = Event.create(
project: @project,
action: Event::Pushed,
data: data,
author_id: @user.id
)
end
Then 'I should see project "Shop" activity feed' do
project = Project.find_by_name("Shop")
page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
end
Then 'I should see project settings' do
current_path.should == edit_project_path(@project)
page.should have_content("Project name is")
page.should have_content("Advanced settings:")
page.should have_content("Features:")
end
def current_project

View file

@ -1,9 +1,13 @@
require 'simplecov' unless ENV['CI']
ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec'
require 'database_cleaner'
require 'spinach/capybara'
require 'sidekiq/testing/inline'
%w(gitolite_stub stubbed_repository valid_commit).each do |f|
require Rails.root.join('spec', 'support', f)