From 9844ddd43f20e84754759688fea39e1a0241bb06 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 3 Aug 2012 19:59:55 +0300 Subject: [PATCH] Comments cucumber. More refactoring. Cucumber -> branches, tags --- features/projects/commits/branches.feature | 12 +++++++++++- features/projects/commits/commit_comments.feature | 5 ++++- features/projects/commits/tags.feature | 3 +-- features/projects/issues/issues.feature | 2 +- features/projects/project.feature | 11 +++++++++++ features/projects/wiki.feature | 6 ++++++ features/step_definitions/project/project_commits_steps.rb | 27 +++++++++++++++++++++++++++ features/step_definitions/project/project_issues_steps.rb | 9 --------- features/step_definitions/project/projects_steps.rb | 14 ++++++++++++++ spec/monkeypatch.rb | 6 +++++- spec/requests/access_spec.rb | 187 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- spec/requests/commits_notes_spec.rb | 28 ---------------------------- spec/requests/repositories_spec.rb | 49 ------------------------------------------------- spec/requests/security/profile_access_spec.rb | 34 ++++++++++++++++++++++++++++++++++ spec/requests/security/project_access_spec.rb | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ spec/requests/team_members_spec.rb | 68 -------------------------------------------------------------------- spec/requests/user_security_spec.rb | 37 ------------------------------------- spec/requests/wikis_notes_spec.rb | 29 ----------------------------- 18 files changed, 301 insertions(+), 413 deletions(-) create mode 100644 features/projects/project.feature delete mode 100644 spec/requests/access_spec.rb delete mode 100644 spec/requests/commits_notes_spec.rb delete mode 100644 spec/requests/repositories_spec.rb create mode 100644 spec/requests/security/profile_access_spec.rb create mode 100644 spec/requests/security/project_access_spec.rb delete mode 100644 spec/requests/team_members_spec.rb delete mode 100644 spec/requests/user_security_spec.rb delete mode 100644 spec/requests/wikis_notes_spec.rb diff --git a/features/projects/commits/branches.feature b/features/projects/commits/branches.feature index 2b136e1..74575c5 100644 --- a/features/projects/commits/branches.feature +++ b/features/projects/commits/branches.feature @@ -2,9 +2,19 @@ Feature: Browse branches Background: Given I signin as a user And I own project "Shop" + And project "Shop" has protected branches Given I visit project branches page - Scenario: I can see all git branches + Scenario: I can see project recent git branches + Then I should see "Shop" recent branches list + + Scenario: I can see project all git branches + Given I click link "All" + Then I should see "Shop" all branches list + + Scenario: I can see project protected git branches + Given I click link "Protected" + Then I should see "Shop" protected branches list Scenario: I can download project by branch diff --git a/features/projects/commits/commit_comments.feature b/features/projects/commits/commit_comments.feature index bdf47b8..9bd56d2 100644 --- a/features/projects/commits/commit_comments.feature +++ b/features/projects/commits/commit_comments.feature @@ -4,4 +4,7 @@ Feature: Comment commit And I own project "Shop" Given I visit project commit page - Scenario: I leave a comment for commit + @javascript + Scenario: I comment commit + Given I leave a comment like "XML attached" + Then I should see comment "XML attached" diff --git a/features/projects/commits/tags.feature b/features/projects/commits/tags.feature index 8122174..f7899fc 100644 --- a/features/projects/commits/tags.feature +++ b/features/projects/commits/tags.feature @@ -5,7 +5,6 @@ Feature: Browse tags Given I visit project tags page Scenario: I can see all git tags + Then I should see "Shop" all tags list Scenario: I can download project by tag - - diff --git a/features/projects/issues/issues.feature b/features/projects/issues/issues.feature index a45dd80..180710c 100644 --- a/features/projects/issues/issues.feature +++ b/features/projects/issues/issues.feature @@ -35,4 +35,4 @@ Feature: Issues Scenario: I comment issue Given I visit issue page "Release 0.4" And I leave a comment like "XML attached" - Then I should see commetn "XML attached" + Then I should see comment "XML attached" diff --git a/features/projects/project.feature b/features/projects/project.feature new file mode 100644 index 0000000..895a928 --- /dev/null +++ b/features/projects/project.feature @@ -0,0 +1,11 @@ +Feature: Project + Background: + Given I signin as a user + And I own project "Shop" + And I visit project "Shop" page + + Scenario: I should see project activity + + Scenario: I edit project + + Scenario: I visit attachments diff --git a/features/projects/wiki.feature b/features/projects/wiki.feature index ed69e87..4441ada 100644 --- a/features/projects/wiki.feature +++ b/features/projects/wiki.feature @@ -7,3 +7,9 @@ Feature: Wiki Scenario: Add new page Given I create Wiki page Then I should see newly created wiki page + + @javascript + Scenario: I comment wiki page + Given I create Wiki page + And I leave a comment like "XML attached" + Then I should see comment "XML attached" diff --git a/features/step_definitions/project/project_commits_steps.rb b/features/step_definitions/project/project_commits_steps.rb index 9b3b0aa..35fcb4d 100644 --- a/features/step_definitions/project/project_commits_steps.rb +++ b/features/step_definitions/project/project_commits_steps.rb @@ -59,3 +59,30 @@ end Given /^I visit project tags page$/ do visit tags_project_repository_path(@project) end + +Then /^I should see "(.*?)" recent branches list$/ do |arg1| + page.should have_content("Branches") + page.should have_content("master") +end + +Then /^I should see "(.*?)" all branches list$/ do |arg1| + page.should have_content("Branches") + page.should have_content("master") +end + +Then /^I should see "(.*?)" all tags list$/ do |arg1| + page.should have_content("Tags") + page.should have_content("v1.2.1") +end + +Then /^I should see "(.*?)" protected branches list$/ do |arg1| + within "table" do + page.should have_content "stable" + page.should_not have_content "master" + end +end + +Given /^project "(.*?)" has protected branches$/ do |arg1| + project = Project.find_by_name(arg1) + project.protected_branches.create(:name => "stable") +end diff --git a/features/step_definitions/project/project_issues_steps.rb b/features/step_definitions/project/project_issues_steps.rb index 2c47f37..00a1721 100644 --- a/features/step_definitions/project/project_issues_steps.rb +++ b/features/step_definitions/project/project_issues_steps.rb @@ -32,15 +32,6 @@ Given /^I visit issue page "(.*?)"$/ do |arg1| visit project_issue_path(issue.project, issue) end -Given /^I leave a comment like "(.*?)"$/ do |arg1| - fill_in "note_note", :with => arg1 - click_button "Add Comment" -end - -Then /^I should see commetn "(.*?)"$/ do |arg1| - page.should have_content(arg1) -end - Given /^I submit new issue "(.*?)"$/ do |arg1| fill_in "issue_title", :with => arg1 click_button "Submit new issue" diff --git a/features/step_definitions/project/projects_steps.rb b/features/step_definitions/project/projects_steps.rb index bca1213..c9af346 100644 --- a/features/step_definitions/project/projects_steps.rb +++ b/features/step_definitions/project/projects_steps.rb @@ -50,6 +50,11 @@ Given /^I write new comment "(.*?)"$/ do |arg1| click_button "Add Comment" end +Given /^I visit project "(.*?)" page$/ do |arg1| + project = Project.find_by_name(arg1) + visit project_path(project) +end + Given /^I visit project "(.*?)" network page$/ do |arg1| project = Project.find_by_name(arg1) visit graph_project_path(project) @@ -66,3 +71,12 @@ Given /^page should have network graph$/ do page.should have_content "notes_refacto..." end end + +Given /^I leave a comment like "(.*?)"$/ do |arg1| + fill_in "note_note", :with => arg1 + click_button "Add Comment" +end + +Then /^I should see comment "(.*?)"$/ do |arg1| + page.should have_content(arg1) +end diff --git a/spec/monkeypatch.rb b/spec/monkeypatch.rb index 6133631..93dda01 100644 --- a/spec/monkeypatch.rb +++ b/spec/monkeypatch.rb @@ -44,4 +44,8 @@ class FakeSatellite end end - +class ProtectedBranch + def update_repository + true + end +end diff --git a/spec/requests/access_spec.rb b/spec/requests/access_spec.rb deleted file mode 100644 index bcca42f..0000000 --- a/spec/requests/access_spec.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'spec_helper' - -describe "Application access" do - describe "GET /" do - it { root_path.should be_allowed_for :admin } - it { root_path.should be_allowed_for :user } - it { root_path.should be_denied_for :visitor } - end - - describe "GET /projects/new" do - it { new_project_path.should be_allowed_for :admin } - it { new_project_path.should be_allowed_for :user } - it { new_project_path.should be_denied_for :visitor } - end - - describe "Project" do - before do - @project = Factory :project - @u1 = Factory :user - @u2 = Factory :user - @u3 = Factory :user - # full access - @project.users_projects.create(:user => @u1, :project_access => UsersProject::MASTER) - # readonly - @project.users_projects.create(:user => @u3, :project_access => UsersProject::REPORTER) - end - - describe "GET /project_code" do - it { project_path(@project).should be_allowed_for @u1 } - it { project_path(@project).should be_allowed_for @u3 } - it { project_path(@project).should be_denied_for :admin } - it { project_path(@project).should be_denied_for @u2 } - it { project_path(@project).should be_denied_for :user } - it { project_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/master/tree" do - it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u1 } - it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u3 } - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :admin } - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for @u2 } - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :user } - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :visitor } - end - - describe "GET /project_code/commits" do - it { project_commits_path(@project).should be_allowed_for @u1 } - it { project_commits_path(@project).should be_allowed_for @u3 } - it { project_commits_path(@project).should be_denied_for :admin } - it { project_commits_path(@project).should be_denied_for @u2 } - it { project_commits_path(@project).should be_denied_for :user } - it { project_commits_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/commit" do - it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u1 } - it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u3 } - it { project_commit_path(@project, @project.commit.id).should be_denied_for :admin } - it { project_commit_path(@project, @project.commit.id).should be_denied_for @u2 } - it { project_commit_path(@project, @project.commit.id).should be_denied_for :user } - it { project_commit_path(@project, @project.commit.id).should be_denied_for :visitor } - end - - describe "GET /project_code/team" do - it { team_project_path(@project).should be_allowed_for @u1 } - it { team_project_path(@project).should be_allowed_for @u3 } - it { team_project_path(@project).should be_denied_for :admin } - it { team_project_path(@project).should be_denied_for @u2 } - it { team_project_path(@project).should be_denied_for :user } - it { team_project_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/wall" do - it { wall_project_path(@project).should be_allowed_for @u1 } - it { wall_project_path(@project).should be_allowed_for @u3 } - it { wall_project_path(@project).should be_denied_for :admin } - it { wall_project_path(@project).should be_denied_for @u2 } - it { wall_project_path(@project).should be_denied_for :user } - it { wall_project_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/blob" do - before do - @commit = @project.commit - @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name - @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path) - end - - it { @blob_path.should be_allowed_for @u1 } - it { @blob_path.should be_allowed_for @u3 } - it { @blob_path.should be_denied_for :admin } - it { @blob_path.should be_denied_for @u2 } - it { @blob_path.should be_denied_for :user } - it { @blob_path.should be_denied_for :visitor } - end - - describe "GET /project_code/edit" do - it { edit_project_path(@project).should be_allowed_for @u1 } - it { edit_project_path(@project).should be_denied_for @u3 } - it { edit_project_path(@project).should be_denied_for :admin } - it { edit_project_path(@project).should be_denied_for @u2 } - it { edit_project_path(@project).should be_denied_for :user } - it { edit_project_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/deploy_keys" do - it { project_deploy_keys_path(@project).should be_allowed_for @u1 } - it { project_deploy_keys_path(@project).should be_denied_for @u3 } - it { project_deploy_keys_path(@project).should be_denied_for :admin } - it { project_deploy_keys_path(@project).should be_denied_for @u2 } - it { project_deploy_keys_path(@project).should be_denied_for :user } - it { project_deploy_keys_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/issues" do - it { project_issues_path(@project).should be_allowed_for @u1 } - it { project_issues_path(@project).should be_allowed_for @u3 } - it { project_issues_path(@project).should be_denied_for :admin } - it { project_issues_path(@project).should be_denied_for @u2 } - it { project_issues_path(@project).should be_denied_for :user } - it { project_issues_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/snippets" do - it { project_snippets_path(@project).should be_allowed_for @u1 } - it { project_snippets_path(@project).should be_allowed_for @u3 } - it { project_snippets_path(@project).should be_denied_for :admin } - it { project_snippets_path(@project).should be_denied_for @u2 } - it { project_snippets_path(@project).should be_denied_for :user } - it { project_snippets_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/merge_requests" do - it { project_merge_requests_path(@project).should be_allowed_for @u1 } - it { project_merge_requests_path(@project).should be_allowed_for @u3 } - it { project_merge_requests_path(@project).should be_denied_for :admin } - it { project_merge_requests_path(@project).should be_denied_for @u2 } - it { project_merge_requests_path(@project).should be_denied_for :user } - it { project_merge_requests_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/repository" do - it { project_repository_path(@project).should be_allowed_for @u1 } - it { project_repository_path(@project).should be_allowed_for @u3 } - it { project_repository_path(@project).should be_denied_for :admin } - it { project_repository_path(@project).should be_denied_for @u2 } - it { project_repository_path(@project).should be_denied_for :user } - it { project_repository_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/repository/branches" do - it { branches_project_repository_path(@project).should be_allowed_for @u1 } - it { branches_project_repository_path(@project).should be_allowed_for @u3 } - it { branches_project_repository_path(@project).should be_denied_for :admin } - it { branches_project_repository_path(@project).should be_denied_for @u2 } - it { branches_project_repository_path(@project).should be_denied_for :user } - it { branches_project_repository_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/repository/tags" do - it { tags_project_repository_path(@project).should be_allowed_for @u1 } - it { tags_project_repository_path(@project).should be_allowed_for @u3 } - it { tags_project_repository_path(@project).should be_denied_for :admin } - it { tags_project_repository_path(@project).should be_denied_for @u2 } - it { tags_project_repository_path(@project).should be_denied_for :user } - it { tags_project_repository_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/hooks" do - it { project_hooks_path(@project).should be_allowed_for @u1 } - it { project_hooks_path(@project).should be_allowed_for @u3 } - it { project_hooks_path(@project).should be_denied_for :admin } - it { project_hooks_path(@project).should be_denied_for @u2 } - it { project_hooks_path(@project).should be_denied_for :user } - it { project_hooks_path(@project).should be_denied_for :visitor } - end - - describe "GET /project_code/files" do - it { files_project_path(@project).should be_allowed_for @u1 } - it { files_project_path(@project).should be_allowed_for @u3 } - it { files_project_path(@project).should be_denied_for :admin } - it { files_project_path(@project).should be_denied_for @u2 } - it { files_project_path(@project).should be_denied_for :user } - it { files_project_path(@project).should be_denied_for :visitor } - end - end -end diff --git a/spec/requests/commits_notes_spec.rb b/spec/requests/commits_notes_spec.rb deleted file mode 100644 index fde42a8..0000000 --- a/spec/requests/commits_notes_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -describe "Issues" do - let(:project) { Factory :project } - let!(:commit) { project.repo.commits.first } - - before do - login_as :user - project.add_access(@user, :read, :write) - end - - describe "add new note", :js => true do - before do - visit project_commit_path(project, commit) - fill_in "note_note", :with => "I commented this commit" - click_button "Add Comment" - end - - it "should conatin new note" do - page.should have_content("I commented this commit") - end - - it "should be displayed when i visit this commit again" do - visit project_commit_path(project, commit) - page.should have_content("I commented this commit") - end - end -end diff --git a/spec/requests/repositories_spec.rb b/spec/requests/repositories_spec.rb deleted file mode 100644 index 1bf4c8d..0000000 --- a/spec/requests/repositories_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'spec_helper' - -describe "Repository" do - - before do - @user = Factory :user - @project = Factory :project - @project.add_access(@user, :read, :write) - login_with @user - end - - describe "GET /:project_name/repository" do - before do - visit project_repository_path(@project) - end - - it "should be on projects page" do - current_path.should == project_repository_path(@project) - end - - it "should have link to last commit for activities tab" do - page.should have_content(@project.commit.safe_message[0..20]) - end - end - - describe "GET /:project_name/repository/branches" do - before do - visit branches_project_repository_path(@project) - end - - it "should have link to repo activities" do - page.should have_content("Branches") - page.should have_content("master") - end - end - - # TODO: Add new repo to seeds with tags list - describe "GET /:project_name/repository/tags" do - before do - visit tags_project_repository_path(@project) - end - - it "should have link to repo activities" do - page.should have_content("Tags") - page.should have_content("v1.2.1") - end - end -end - diff --git a/spec/requests/security/profile_access_spec.rb b/spec/requests/security/profile_access_spec.rb new file mode 100644 index 0000000..b8ed27f --- /dev/null +++ b/spec/requests/security/profile_access_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +describe "Users Security" do + describe "Project" do + before do + @u1 = Factory :user + end + + describe "GET /login" do + it { new_user_session_path.should_not be_404_for :visitor } + end + + describe "GET /keys" do + it { keys_path.should be_allowed_for @u1 } + it { keys_path.should be_allowed_for :admin } + it { keys_path.should be_allowed_for :user } + it { keys_path.should be_denied_for :visitor } + end + + describe "GET /profile" do + it { profile_path.should be_allowed_for @u1 } + it { profile_path.should be_allowed_for :admin } + it { profile_path.should be_allowed_for :user } + it { profile_path.should be_denied_for :visitor } + end + + describe "GET /profile/password" do + it { profile_password_path.should be_allowed_for @u1 } + it { profile_password_path.should be_allowed_for :admin } + it { profile_password_path.should be_allowed_for :user } + it { profile_password_path.should be_denied_for :visitor } + end + end +end diff --git a/spec/requests/security/project_access_spec.rb b/spec/requests/security/project_access_spec.rb new file mode 100644 index 0000000..bcca42f --- /dev/null +++ b/spec/requests/security/project_access_spec.rb @@ -0,0 +1,187 @@ +require 'spec_helper' + +describe "Application access" do + describe "GET /" do + it { root_path.should be_allowed_for :admin } + it { root_path.should be_allowed_for :user } + it { root_path.should be_denied_for :visitor } + end + + describe "GET /projects/new" do + it { new_project_path.should be_allowed_for :admin } + it { new_project_path.should be_allowed_for :user } + it { new_project_path.should be_denied_for :visitor } + end + + describe "Project" do + before do + @project = Factory :project + @u1 = Factory :user + @u2 = Factory :user + @u3 = Factory :user + # full access + @project.users_projects.create(:user => @u1, :project_access => UsersProject::MASTER) + # readonly + @project.users_projects.create(:user => @u3, :project_access => UsersProject::REPORTER) + end + + describe "GET /project_code" do + it { project_path(@project).should be_allowed_for @u1 } + it { project_path(@project).should be_allowed_for @u3 } + it { project_path(@project).should be_denied_for :admin } + it { project_path(@project).should be_denied_for @u2 } + it { project_path(@project).should be_denied_for :user } + it { project_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/master/tree" do + it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u1 } + it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u3 } + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :admin } + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for @u2 } + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :user } + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :visitor } + end + + describe "GET /project_code/commits" do + it { project_commits_path(@project).should be_allowed_for @u1 } + it { project_commits_path(@project).should be_allowed_for @u3 } + it { project_commits_path(@project).should be_denied_for :admin } + it { project_commits_path(@project).should be_denied_for @u2 } + it { project_commits_path(@project).should be_denied_for :user } + it { project_commits_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/commit" do + it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u1 } + it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u3 } + it { project_commit_path(@project, @project.commit.id).should be_denied_for :admin } + it { project_commit_path(@project, @project.commit.id).should be_denied_for @u2 } + it { project_commit_path(@project, @project.commit.id).should be_denied_for :user } + it { project_commit_path(@project, @project.commit.id).should be_denied_for :visitor } + end + + describe "GET /project_code/team" do + it { team_project_path(@project).should be_allowed_for @u1 } + it { team_project_path(@project).should be_allowed_for @u3 } + it { team_project_path(@project).should be_denied_for :admin } + it { team_project_path(@project).should be_denied_for @u2 } + it { team_project_path(@project).should be_denied_for :user } + it { team_project_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/wall" do + it { wall_project_path(@project).should be_allowed_for @u1 } + it { wall_project_path(@project).should be_allowed_for @u3 } + it { wall_project_path(@project).should be_denied_for :admin } + it { wall_project_path(@project).should be_denied_for @u2 } + it { wall_project_path(@project).should be_denied_for :user } + it { wall_project_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/blob" do + before do + @commit = @project.commit + @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name + @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path) + end + + it { @blob_path.should be_allowed_for @u1 } + it { @blob_path.should be_allowed_for @u3 } + it { @blob_path.should be_denied_for :admin } + it { @blob_path.should be_denied_for @u2 } + it { @blob_path.should be_denied_for :user } + it { @blob_path.should be_denied_for :visitor } + end + + describe "GET /project_code/edit" do + it { edit_project_path(@project).should be_allowed_for @u1 } + it { edit_project_path(@project).should be_denied_for @u3 } + it { edit_project_path(@project).should be_denied_for :admin } + it { edit_project_path(@project).should be_denied_for @u2 } + it { edit_project_path(@project).should be_denied_for :user } + it { edit_project_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/deploy_keys" do + it { project_deploy_keys_path(@project).should be_allowed_for @u1 } + it { project_deploy_keys_path(@project).should be_denied_for @u3 } + it { project_deploy_keys_path(@project).should be_denied_for :admin } + it { project_deploy_keys_path(@project).should be_denied_for @u2 } + it { project_deploy_keys_path(@project).should be_denied_for :user } + it { project_deploy_keys_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/issues" do + it { project_issues_path(@project).should be_allowed_for @u1 } + it { project_issues_path(@project).should be_allowed_for @u3 } + it { project_issues_path(@project).should be_denied_for :admin } + it { project_issues_path(@project).should be_denied_for @u2 } + it { project_issues_path(@project).should be_denied_for :user } + it { project_issues_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/snippets" do + it { project_snippets_path(@project).should be_allowed_for @u1 } + it { project_snippets_path(@project).should be_allowed_for @u3 } + it { project_snippets_path(@project).should be_denied_for :admin } + it { project_snippets_path(@project).should be_denied_for @u2 } + it { project_snippets_path(@project).should be_denied_for :user } + it { project_snippets_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/merge_requests" do + it { project_merge_requests_path(@project).should be_allowed_for @u1 } + it { project_merge_requests_path(@project).should be_allowed_for @u3 } + it { project_merge_requests_path(@project).should be_denied_for :admin } + it { project_merge_requests_path(@project).should be_denied_for @u2 } + it { project_merge_requests_path(@project).should be_denied_for :user } + it { project_merge_requests_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/repository" do + it { project_repository_path(@project).should be_allowed_for @u1 } + it { project_repository_path(@project).should be_allowed_for @u3 } + it { project_repository_path(@project).should be_denied_for :admin } + it { project_repository_path(@project).should be_denied_for @u2 } + it { project_repository_path(@project).should be_denied_for :user } + it { project_repository_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/repository/branches" do + it { branches_project_repository_path(@project).should be_allowed_for @u1 } + it { branches_project_repository_path(@project).should be_allowed_for @u3 } + it { branches_project_repository_path(@project).should be_denied_for :admin } + it { branches_project_repository_path(@project).should be_denied_for @u2 } + it { branches_project_repository_path(@project).should be_denied_for :user } + it { branches_project_repository_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/repository/tags" do + it { tags_project_repository_path(@project).should be_allowed_for @u1 } + it { tags_project_repository_path(@project).should be_allowed_for @u3 } + it { tags_project_repository_path(@project).should be_denied_for :admin } + it { tags_project_repository_path(@project).should be_denied_for @u2 } + it { tags_project_repository_path(@project).should be_denied_for :user } + it { tags_project_repository_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/hooks" do + it { project_hooks_path(@project).should be_allowed_for @u1 } + it { project_hooks_path(@project).should be_allowed_for @u3 } + it { project_hooks_path(@project).should be_denied_for :admin } + it { project_hooks_path(@project).should be_denied_for @u2 } + it { project_hooks_path(@project).should be_denied_for :user } + it { project_hooks_path(@project).should be_denied_for :visitor } + end + + describe "GET /project_code/files" do + it { files_project_path(@project).should be_allowed_for @u1 } + it { files_project_path(@project).should be_allowed_for @u3 } + it { files_project_path(@project).should be_denied_for :admin } + it { files_project_path(@project).should be_denied_for @u2 } + it { files_project_path(@project).should be_denied_for :user } + it { files_project_path(@project).should be_denied_for :visitor } + end + end +end diff --git a/spec/requests/team_members_spec.rb b/spec/requests/team_members_spec.rb deleted file mode 100644 index 34e34f5..0000000 --- a/spec/requests/team_members_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'spec_helper' - -describe "TeamMembers" do - before do - login_as :user - @project = Factory :project - @project.add_access(@user, :read, :admin) - end - - describe "Update profile", :js => true do - it "should update user role" do - @project.master_access_for?(@user).should be_true - visit team_project_path(@project) - select "Developer", :from => "team_member_project_access" - @project.master_access_for?(@user).should be_false - @project.dev_access_for?(@user).should be_true - end - end - - describe "View profile" do - it "should be available" do - visit(team_project_path(@project)) - click_link(@user.name) - page.should have_content @user.skype - page.should_not have_content 'Twitter' - end - end - - describe "New Team member" do - before do - @user_1 = Factory :user - visit team_project_path(@project) - click_link "New Team Member" - end - - it "should open new team member popup" do - page.should have_content("New Team member") - end - - describe "fill in" do - before do - within "#new_team_member" do - select @user_1.name, :from => "team_member_user_id" - select "Reporter", :from => "team_member_project_access" - end - end - - it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) } - - it "should add new member to table" do - click_button "Save" - @member = UsersProject.last - - page.should have_content @user_1.name - - @member.reload - @member.project_access.should == UsersProject::REPORTER - end - end - end - - describe "Cancel membership" do - it "should cancel membership" do - visit project_team_member_path(@project, @project.users_projects.last) - expect { click_link "Remove from team" }.to change { UsersProject.count }.by(-1) - end - end -end diff --git a/spec/requests/user_security_spec.rb b/spec/requests/user_security_spec.rb deleted file mode 100644 index b75a177..0000000 --- a/spec/requests/user_security_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'spec_helper' - -describe "Users Security" do - describe "Project" do - before do - @u1 = Factory :user - end - - describe "GET /login" do - #it { new_user_session_path.should be_denied_for @u1 } - #it { new_user_session_path.should be_denied_for :admin } - #it { new_user_session_path.should be_denied_for :user } - it { new_user_session_path.should_not be_404_for :visitor } - end - - describe "GET /keys" do - it { keys_path.should be_allowed_for @u1 } - it { keys_path.should be_allowed_for :admin } - it { keys_path.should be_allowed_for :user } - it { keys_path.should be_denied_for :visitor } - end - - describe "GET /profile" do - it { profile_path.should be_allowed_for @u1 } - it { profile_path.should be_allowed_for :admin } - it { profile_path.should be_allowed_for :user } - it { profile_path.should be_denied_for :visitor } - end - - describe "GET /profile/password" do - it { profile_password_path.should be_allowed_for @u1 } - it { profile_password_path.should be_allowed_for :admin } - it { profile_password_path.should be_allowed_for :user } - it { profile_password_path.should be_denied_for :visitor } - end - end -end diff --git a/spec/requests/wikis_notes_spec.rb b/spec/requests/wikis_notes_spec.rb deleted file mode 100644 index 144d031..0000000 --- a/spec/requests/wikis_notes_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe "Wikis" do - let(:project) { Factory :project } - - before do - login_as :user - project.add_access(@user, :read, :write) - end - - describe "add new note", :js => true do - before do - visit project_wiki_path(project, :index) - - fill_in "Title", :with => 'Test title' - fill_in "Content", :with => '[link test](test)' - click_on "Save" - - page.should have_content("Test title") - - fill_in "note_note", :with => "Comment on wiki!" - click_button "Add Comment" - end - - it "should contain the new note" do - page.should have_content("Comment on wiki!") - end - end -end -- libgit2 0.21.2