diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-15 03:52:25 +0400 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-15 03:52:25 +0400 |
commit | 30227869482bbbdbfea153f2b45ef3bb9a9fd218 (patch) | |
tree | aff64071116447092751770d2896998f62d1b44a /features | |
parent | 8ee5fce9d64b70d8981896457484fae622d142c9 (diff) | |
parent | aca0caa8cc1a6bd481f87dd810284e69d3747050 (diff) |
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
Diffstat (limited to 'features')
32 files changed, 456 insertions, 81 deletions
diff --git a/features/admin/groups.feature b/features/admin/groups.feature index e5eab8e6ecb..28f35e3a831 100644 --- a/features/admin/groups.feature +++ b/features/admin/groups.feature @@ -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" diff --git a/features/admin/logs.feature b/features/admin/logs.feature new file mode 100644 index 00000000000..d07f0048080 --- /dev/null +++ b/features/admin/logs.feature @@ -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 diff --git a/features/admin/projects.feature b/features/admin/projects.feature new file mode 100644 index 00000000000..4a4ee1c11e0 --- /dev/null +++ b/features/admin/projects.feature @@ -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 diff --git a/features/admin/users.feature b/features/admin/users.feature new file mode 100644 index 00000000000..03ac86a367b --- /dev/null +++ b/features/admin/users.feature @@ -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 diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index 972f8e36609..759843692b8 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -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" diff --git a/features/dashboard/event_filters.feature b/features/dashboard/event_filters.feature new file mode 100644 index 00000000000..e0c6b84b008 --- /dev/null +++ b/features/dashboard/event_filters.feature @@ -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 diff --git a/features/group/group.feature b/features/group/group.feature index 07308112270..a4a55a7fc26 100644 --- a/features/group/group.feature +++ b/features/group/group.feature @@ -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 diff --git a/features/project/project.feature b/features/project/project.feature index 1c9f201df50..ad3d06bb41f 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -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 diff --git a/features/project/service.feature b/features/project/service.feature new file mode 100644 index 00000000000..ca8a4756056 --- /dev/null +++ b/features/project/service.feature @@ -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 diff --git a/features/steps/admin/admin_active_tab.rb b/features/steps/admin/admin_active_tab.rb index 05a9a686e01..48ec7bac0d6 100644 --- a/features/steps/admin/admin_active_tab.rb +++ b/features/steps/admin/admin_active_tab.rb @@ -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 diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb index 5386f473320..cbca2daa701 100644 --- a/features/steps/admin/admin_groups.rb +++ b/features/steps/admin/admin_groups.rb @@ -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 diff --git a/features/steps/admin/admin_logs.rb b/features/steps/admin/admin_logs.rb new file mode 100644 index 00000000000..83958545c4d --- /dev/null +++ b/features/steps/admin/admin_logs.rb @@ -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 diff --git a/features/steps/admin/admin_projects.rb b/features/steps/admin/admin_projects.rb new file mode 100644 index 00000000000..dd6b4e9810b --- /dev/null +++ b/features/steps/admin/admin_projects.rb @@ -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 diff --git a/features/steps/admin/admin_users.rb b/features/steps/admin/admin_users.rb new file mode 100644 index 00000000000..1828ae705ce --- /dev/null +++ b/features/steps/admin/admin_users.rb @@ -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 diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index 775a721f1a4..4bcefba76de 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -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 diff --git a/features/steps/dashboard/dashboard_event_filters.rb b/features/steps/dashboard/dashboard_event_filters.rb new file mode 100644 index 00000000000..bfc053631ab --- /dev/null +++ b/features/steps/dashboard/dashboard_event_filters.rb @@ -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 + diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb index 5ace88023f0..fcf4296ad11 100644 --- a/features/steps/dashboard/dashboard_issues.rb +++ b/features/steps/dashboard/dashboard_issues.rb @@ -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 diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb index 485a4ccc113..7cfa8a13ff8 100644 --- a/features/steps/dashboard/dashboard_merge_requests.rb +++ b/features/steps/dashboard/dashboard_merge_requests.rb @@ -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 diff --git a/features/steps/dashboard/dashboard_search.rb b/features/steps/dashboard/dashboard_search.rb index a34c14d0c5f..9c8c879479d 100644 --- a/features/steps/dashboard/dashboard_search.rb +++ b/features/steps/dashboard/dashboard_search.rb @@ -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" diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 4de260ec33e..04d8c874b3e 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -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, diff --git a/features/steps/project/create_project.rb b/features/steps/project/create_project.rb index b9b4534ed68..0d9727732c7 100644 --- a/features/steps/project/create_project.rb +++ b/features/steps/project/create_project.rb @@ -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 diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index f33f12eb0a8..7a85f57a218 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -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 diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb index 2c03ce14fc1..3433c2ba5f6 100644 --- a/features/steps/project/project_browse_commits.rb +++ b/features/steps/project/project_browse_commits.rb @@ -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 diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb index 5248a5c469c..f5b51737c8c 100644 --- a/features/steps/project/project_merge_requests.rb +++ b/features/steps/project/project_merge_requests.rb @@ -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 diff --git a/features/steps/project/project_milestones.rb b/features/steps/project/project_milestones.rb index 1c9ad6da651..1350938ee9a 100644 --- a/features/steps/project/project_milestones.rb +++ b/features/steps/project/project_milestones.rb @@ -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 diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb index 6fde532f1a2..77149bfe2c3 100644 --- a/features/steps/project/project_network_graph.rb +++ b/features/steps/project/project_network_graph.rb @@ -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 diff --git a/features/steps/project/project_services.rb b/features/steps/project/project_services.rb new file mode 100644 index 00000000000..b1668ff7207 --- /dev/null +++ b/features/steps/project/project_services.rb @@ -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 diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb index 6bde0b64dfa..91b3ffeee9a 100644 --- a/features/steps/project/project_team_management.rb +++ b/features/steps/project/project_team_management.rb @@ -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 diff --git a/features/steps/shared/admin.rb b/features/steps/shared/admin.rb new file mode 100644 index 00000000000..1b712dc6d04 --- /dev/null +++ b/features/steps/shared/admin.rb @@ -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 + diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index bf20d5f8442..c046c4e63e6 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -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 diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index dfc8ce9d99c..3150be5ef18 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -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 diff --git a/features/support/env.rb b/features/support/env.rb index 500de0f3e20..be10ad1b8b9 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -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) |