From 1127c9849096868eb3762350fc2b4124fd209cab Mon Sep 17 00:00:00 2001 From: miks Date: Thu, 26 Jul 2012 11:47:17 +0300 Subject: [PATCH 01/14] Add automatic HTML id attributes to markdown headings to allow linking to content sections in wiki --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3f15fd92..ce1ff151 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -43,7 +43,7 @@ module ApplicationHelper end def markdown(text) - @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(filter_html: true), { + @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new({ filter_html: true, with_toc_data: true }), { no_intra_emphasis: true, tables: true, fenced_code_blocks: true, From 5cb47b761c0725c4045ff00dbeff63e2f47196ce Mon Sep 17 00:00:00 2001 From: natrim Date: Fri, 27 Jul 2012 12:03:30 +0300 Subject: [PATCH 02/14] fix checking for right gitolite UMASK --- lib/tasks/gitlab/status.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/status.rake b/lib/tasks/gitlab/status.rake index 96b8886f..bc4e86ea 100644 --- a/lib/tasks/gitlab/status.rake +++ b/lib/tasks/gitlab/status.rake @@ -49,7 +49,7 @@ namespace :gitlab do end print "UMASK for .gitolite.rc is 0007? ............" - unless open("#{git_base_path}/../.gitolite.rc").grep(/REPO_UMASK = 0007/).empty? + unless open("#{git_base_path}/../.gitolite.rc").grep(/UMASK([ \t]*)=([ \t>]*)0007/).empty? puts "YES".green else puts "NO".red From e8261313a71fb69adeedc15e15fb572282ceaf06 Mon Sep 17 00:00:00 2001 From: randx Date: Sat, 28 Jul 2012 05:43:34 +0300 Subject: [PATCH 03/14] Fixed firefox css bug with issues table --- app/assets/stylesheets/sections/issues.scss | 38 +++++++++++++++++---- app/views/issues/_show.html.haml | 5 +-- app/views/issues/index.html.haml | 14 ++++---- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss index 82f180c5..1b61ec3f 100644 --- a/app/assets/stylesheets/sections/issues.scss +++ b/app/assets/stylesheets/sections/issues.scss @@ -51,25 +51,51 @@ input.check_all_issues { float:left; - padding: 8px 0; - margin: 14px 0; + padding: 0; + margin:0; margin-right: 10px; + position: relative; + top: 8px; + height: 22px; +} + +.issues_content { + .title { + height: 40px; + } } #issues-table-holder { + .issues_filters { + form { + padding:0; + margin:0; + margin-top:7px + } + } + .issues_bulk_update { - padding: 0 5px; margin: 0; form { + padding:0; margin:0; - padding-bottom:5px; + margin-top:7px } .update_selected_issues { position:relative; top:-2px; - margin-left:3px; + margin-left:4px; + float:left; } - + .update_issues_text { + padding:3px; + line-height: 18px; + float:left; + } } } + +#update_status { + width:100px; +} diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index 574777be..37f17370 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -1,6 +1,7 @@ %li.wll{ :id => dom_id(issue), :class => issue_css_classes(issue), :url => project_issue_path(issue.project, issue) } - .issue_check - = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, :class => "selected_issue", :disabled => !can?(current_user, :modify_issue, issue) + - if controller.controller_name == 'issues' + .issue_check + = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, :class => "selected_issue", :disabled => !can?(current_user, :modify_issue, issue) .right - issue.labels.each do |label| %span.label.label-issue.grouped diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index f033536e..27eff501 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -22,13 +22,13 @@ .issues_bulk_update.hide = form_tag bulk_update_project_issues_path(@project), :method => :post do - %span Update selected issues with -   - = select_tag('update[status]', options_for_select(['open', 'closed']), :prompt => "Status") - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee") - = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone") - = hidden_field_tag 'update[issues_ids]', [] - = hidden_field_tag :f, params[:f] + %span.update_issues_text Update selected issues with   + .left + = select_tag('update[status]', options_for_select(['open', 'closed']), :prompt => "Status") + = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee") + = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone") + = hidden_field_tag 'update[issues_ids]', [] + = hidden_field_tag :f, params[:f] = button_tag "Save", :class => "btn update_selected_issues" .issues_filters .left From 516a76c9a915e5319b4a53f1eb2c3daedbd5ca2c Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Wed, 1 Aug 2012 11:19:20 +0100 Subject: [PATCH 04/14] Fixed grammar in 'please wait' message after creating project --- app/views/projects/new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 0d119bd1..703e558a 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -6,7 +6,7 @@ %div.ajax_loader.hide %center %div.padded= image_tag "ajax_loader.gif" - %h3.prepend-top Creating project & repository. Please wait for few minutes + %h3.prepend-top Creating project & repository. Please wait a few minutes :javascript $(function(){ new Projects(); }); From 9912770c6f0177f496112543064355f79badf94b Mon Sep 17 00:00:00 2001 From: gitlab system Date: Thu, 2 Aug 2012 09:48:46 +0700 Subject: [PATCH 05/14] make hooks respect http basic authentication --- app/models/web_hook.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb index 85d87898..76efa501 100644 --- a/app/models/web_hook.rb +++ b/app/models/web_hook.rb @@ -11,7 +11,16 @@ class WebHook < ActiveRecord::Base message: "should be a valid url" } def execute(data) - WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) + parsed_url = URI.parse(url) + if parsed_url.userinfo.blank? + WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) + else + post_url = url.gsub(parsed_url.userinfo+"@", "") + WebHook.post(post_url, + body: data.to_json, + headers: { "Content-Type" => "application/json" }, + basic_auth: {username: parsed_url.user, password: parsed_url.password}) + end end end From 6de488259701af4b69282ad105882dba423fb666 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 3 Aug 2012 19:29:54 +0300 Subject: [PATCH 06/14] Remove duplicate coverage in spec requests. All features should be covered in cucumber --- features/dashboard/dashboard.feature | 2 +- features/profile/profile.feature | 6 +- ...feature.commented => browse_files.feature} | 0 features/projects/source/git_blame.feature | 10 +++ .../step_definitions/browse_code_steps.rb | 10 +++ features/step_definitions/profile_steps.rb | 13 +++ .../{ => atom}/dashboard_issues_spec.rb | 8 -- spec/requests/{ => atom}/dashboard_spec.rb | 12 --- spec/requests/commits_spec.rb | 68 -------------- .../requests/dashboard_merge_requests_spec.rb | 40 --------- spec/requests/file_blame_spec.rb | 25 ------ spec/requests/keys_spec.rb | 65 -------------- spec/requests/last_push_widget_spec.rb | 52 ----------- spec/requests/profile_spec.rb | 82 ----------------- spec/requests/projects_spec.rb | 77 ---------------- spec/requests/projects_tree_spec.rb | 90 ------------------- spec/requests/projects_wall_spec.rb | 33 ------- spec/requests/wikis_spec.rb | 35 -------- 18 files changed, 39 insertions(+), 589 deletions(-) rename features/projects/source/{browse_files.feature.commented => browse_files.feature} (100%) rename spec/requests/{ => atom}/dashboard_issues_spec.rb (85%) rename spec/requests/{ => atom}/dashboard_spec.rb (70%) delete mode 100644 spec/requests/commits_spec.rb delete mode 100644 spec/requests/dashboard_merge_requests_spec.rb delete mode 100644 spec/requests/file_blame_spec.rb delete mode 100644 spec/requests/keys_spec.rb delete mode 100644 spec/requests/last_push_widget_spec.rb delete mode 100644 spec/requests/profile_spec.rb delete mode 100644 spec/requests/projects_tree_spec.rb delete mode 100644 spec/requests/projects_wall_spec.rb delete mode 100644 spec/requests/wikis_spec.rb diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index 2d66af53..a8c2205c 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -10,7 +10,7 @@ Feature: Dashboard Then I should see "Shop" project link Then I should see project "Shop" activity feed - Scenario: I should see last pish widget + Scenario: I should see last push widget Then I should see last push widget And I click "Create Merge Request" link Then I see prefilled new Merge Request page diff --git a/features/profile/profile.feature b/features/profile/profile.feature index e3d71abc..afda4b55 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -6,6 +6,11 @@ Feature: Profile Given I visit profile page Then I should see my profile info + Scenario: I edit profile + Given I visit profile page + Then I change my contact info + And I should see new contact info + Scenario: I change my password Given I visit profile password page Then I change my password @@ -15,4 +20,3 @@ Feature: Profile Given I visit profile token page Then I reset my token And I should see new token - diff --git a/features/projects/source/browse_files.feature.commented b/features/projects/source/browse_files.feature similarity index 100% rename from features/projects/source/browse_files.feature.commented rename to features/projects/source/browse_files.feature diff --git a/features/projects/source/git_blame.feature b/features/projects/source/git_blame.feature index e69de29b..6aa6be47 100644 --- a/features/projects/source/git_blame.feature +++ b/features/projects/source/git_blame.feature @@ -0,0 +1,10 @@ +Feature: Browse git repo + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project source page + + Scenario: I blame file + Given I click on file from repo + And I click blame button + Then I should see git file blame diff --git a/features/step_definitions/browse_code_steps.rb b/features/step_definitions/browse_code_steps.rb index fc3cf56a..7f9001bb 100644 --- a/features/step_definitions/browse_code_steps.rb +++ b/features/step_definitions/browse_code_steps.rb @@ -38,3 +38,13 @@ end Then /^I should see raw file content$/ do page.source.should == ValidCommit::BLOB_FILE end + +Given /^I click blame button$/ do + click_link "blame" +end + +Then /^I should see git file blame$/ do + page.should have_content("rubygems.org") + page.should have_content("Dmitriy Zaporozhets") + page.should have_content("bc3735004cb Moving to rails 3.2") +end diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb index 7510c536..4661139c 100644 --- a/features/step_definitions/profile_steps.rb +++ b/features/step_definitions/profile_steps.rb @@ -36,3 +36,16 @@ Then /^I should see new token$/ do find("#token").value.should == @user.reload.private_token end +Then /^I change my contact info$/ do + fill_in "user_skype", :with => "testskype" + fill_in "user_linkedin", :with => "testlinkedin" + fill_in "user_twitter", :with => "testtwitter" + click_button "Save" + @user.reload +end + +Then /^I should see new contact info$/ do + @user.skype.should == 'testskype' + @user.linkedin.should == 'testlinkedin' + @user.twitter.should == 'testtwitter' +end diff --git a/spec/requests/dashboard_issues_spec.rb b/spec/requests/atom/dashboard_issues_spec.rb similarity index 85% rename from spec/requests/dashboard_issues_spec.rb rename to spec/requests/atom/dashboard_issues_spec.rb index 29c79313..7260dcf4 100644 --- a/spec/requests/dashboard_issues_spec.rb +++ b/spec/requests/atom/dashboard_issues_spec.rb @@ -30,14 +30,6 @@ describe "User Issues Dashboard" do visit dashboard_issues_path end - subject { page } - - it { should have_content(@issue1.title[0..10]) } - it { should have_content(@issue1.project.name) } - - it { should have_content(@issue2.title[0..10]) } - it { should have_content(@issue2.project.name) } - describe "atom feed", :js => false do it "should render atom feed via private token" do logout diff --git a/spec/requests/dashboard_spec.rb b/spec/requests/atom/dashboard_spec.rb similarity index 70% rename from spec/requests/dashboard_spec.rb rename to spec/requests/atom/dashboard_spec.rb index 16ededd0..4db8ce49 100644 --- a/spec/requests/dashboard_spec.rb +++ b/spec/requests/atom/dashboard_spec.rb @@ -10,18 +10,6 @@ describe "User Dashboard" do visit dashboard_path end - it "should be on projects page" do - current_path.should == dashboard_path - end - - it "should have link to new project" do - page.should have_content("New Project") - end - - it "should have project" do - page.should have_content(@project.name) - end - it "should render projects atom feed via private token" do logout diff --git a/spec/requests/commits_spec.rb b/spec/requests/commits_spec.rb deleted file mode 100644 index ae36a932..00000000 --- a/spec/requests/commits_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'spec_helper' - -describe "Commits" do - let(:project) { Factory :project } - let!(:commit) { CommitDecorator.decorate(project.commit) } - before do - login_as :user - project.add_access(@user, :read) - end - - describe "GET /commits" do - before do - visit project_commits_path(project) - end - - it "should have valid path" do - current_path.should == project_commits_path(project) - end - - it "should have project name" do - page.should have_content(project.name) - end - - it "should list commits" do - page.should have_content(commit.description) - page.should have_content(commit.short_id(8)) - end - - it "should render atom feed" do - visit project_commits_path(project, :atom) - - 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) - page.body.should have_selector("entry summary", :text => commit.description) - end - - it "should render atom feed via private token" do - logout - visit project_commits_path(project, :atom, :private_token => @user.private_token) - - 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) - page.body.should have_selector("entry summary", :text => commit.description) - end - end - - describe "GET /commits/:id" do - before do - visit project_commit_path(project, commit.id) - end - - it "should have valid path" do - current_path.should == project_commit_path(project, commit.id) - end - end - - describe "GET /commits/compare" do - before do - visit compare_project_commits_path(project) - end - - it "should have valid path" do - current_path.should == compare_project_commits_path(project) - end - end -end diff --git a/spec/requests/dashboard_merge_requests_spec.rb b/spec/requests/dashboard_merge_requests_spec.rb deleted file mode 100644 index f345a858..00000000 --- a/spec/requests/dashboard_merge_requests_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'spec_helper' - -describe "User MergeRequests" do - describe "GET /issues" do - before do - - login_as :user - - @project1 = Factory :project, - :path => "project1", - :code => "TEST1" - - @project2 = Factory :project, - :path => "project2", - :code => "TEST2" - - @project1.add_access(@user, :read, :write) - @project2.add_access(@user, :read, :write) - - @merge_request1 = Factory :merge_request, - :author => @user, - :assignee => @user, - :project => @project1 - - @merge_request2 = Factory :merge_request, - :author => @user, - :assignee => @user, - :project => @project2 - - visit dashboard_merge_requests_path - end - - subject { page } - - it { should have_content(@merge_request1.title[0..10]) } - it { should have_content(@merge_request1.project.name) } - it { should have_content(@merge_request2.title[0..10]) } - it { should have_content(@merge_request2.project.name) } - end -end diff --git a/spec/requests/file_blame_spec.rb b/spec/requests/file_blame_spec.rb deleted file mode 100644 index 511f340c..00000000 --- a/spec/requests/file_blame_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'spec_helper' - -describe "Blame file" do - before { login_as :user } - - describe "GET /:projectname/:commit/blob/Gemfile" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile") - click_link "blame" - end - - it "should be correct path" do - current_path.should == blame_file_project_ref_path(@project, @project.root_ref, :path => "Gemfile") - end - - it "should contain file view" do - page.should have_content("rubygems.org") - page.should have_content("Dmitriy Zaporozhets") - page.should have_content("bc3735004cb Moving to rails 3.2") - end - end -end diff --git a/spec/requests/keys_spec.rb b/spec/requests/keys_spec.rb deleted file mode 100644 index 2bc7c75b..00000000 --- a/spec/requests/keys_spec.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'spec_helper' - -describe "Issues" do - before do - login_as :user - end - - describe "GET /keys" do - before do - @key = Factory :key, :user => @user - visit keys_path - end - - subject { page } - - it { should have_content(@key.title) } - - describe "Destroy" do - before { visit key_path(@key) } - - it "should remove entry" do - expect { - click_link "Remove" - }.to change { @user.keys.count }.by(-1) - end - end - end - - describe "New key" do - before do - visit keys_path - click_link "Add new" - end - - it "should open new key popup" do - page.should have_content("New key") - end - - describe "fill in" do - before do - fill_in "key_title", :with => "laptop" - fill_in "key_key", :with => "publickey234=" - end - - it { expect { click_button "Save" }.to change {Key.count}.by(1) } - - it "should add new key to table" do - click_button "Save" - - page.should_not have_content("New key") - page.should have_content "laptop" - end - end - end - - describe "Show page" do - before do - @key = Factory :key, :user => @user - visit key_path(@key) - end - - it { page.should have_content @key.title } - it { page.should have_content @key.key[0..10] } - end -end diff --git a/spec/requests/last_push_widget_spec.rb b/spec/requests/last_push_widget_spec.rb deleted file mode 100644 index 0baa20c6..00000000 --- a/spec/requests/last_push_widget_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'spec_helper' - -describe "Last Push widget" do - before { login_as :user } - - before do - @project = Factory :project, :owner => @user - @project.add_access(@user, :read) - create_push_event - visit dashboard_path - end - - it "should display last push widget with link to merge request page" do - page.should have_content "Your pushed to branch new_design" - page.should have_link "Create Merge Request" - end - - describe "click create MR" do - before { click_link "Create Merge Request" } - - it { current_path.should == new_project_merge_request_path(@project) } - it { find("#merge_request_source_branch").value.should == "new_design" } - it { find("#merge_request_target_branch").value.should == "master" } - it { find("#merge_request_title").value.should == "New Design" } - end - - - def create_push_event - 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 -end - diff --git a/spec/requests/profile_spec.rb b/spec/requests/profile_spec.rb deleted file mode 100644 index 6f9af608..00000000 --- a/spec/requests/profile_spec.rb +++ /dev/null @@ -1,82 +0,0 @@ -require 'spec_helper' - -describe "Profile" do - before do - login_as :user - end - - describe "Show profile" do - before do - visit profile_path - end - - it { page.should have_content(@user.name) } - end - - describe "Profile update" do - before do - visit profile_path - fill_in "user_skype", :with => "testskype" - fill_in "user_linkedin", :with => "testlinkedin" - fill_in "user_twitter", :with => "testtwitter" - click_button "Save" - @user.reload - end - - it { @user.skype.should == 'testskype' } - it { @user.linkedin.should == 'testlinkedin' } - it { @user.twitter.should == 'testtwitter' } - end - - describe "Reset private token" do - before do - visit profile_token_path - end - - it "should reset private token" do - user_first_token = @user.private_token - click_button "Reset" - @user.reload - @user.private_token.should_not == user_first_token - end - end - - describe "Password update" do - before do - visit profile_password_path - end - - it { page.should have_content("Password") } - it { page.should have_content("Password confirmation") } - - describe "change password" do - before do - @old_pwd = @user.encrypted_password - fill_in "user_password", :with => "777777" - fill_in "user_password_confirmation", :with => "777777" - click_button "Save" - @user.reload - end - - it "should redirect to signin page" do - current_path.should == new_user_session_path - end - - it "should change password" do - @user.encrypted_password.should_not == @old_pwd - end - - describe "login with new password" do - before do - fill_in "user_email", :with => @user.email - fill_in "user_password", :with => "777777" - click_button "Sign in" - end - - it "should login user" do - current_path.should == root_path - end - end - end - end -end diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index c9c34846..f96affc7 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -3,47 +3,6 @@ require 'spec_helper' describe "Projects" do before { login_as :user } - describe "GET /projects/new" do - before do - visit root_path - click_link "New Project" - end - - it "should be correct path" do - current_path.should == new_project_path - end - - it "should have labels for new project" do - page.should have_content("Project name is") - end - end - - describe "POST /projects" do - before do - visit new_project_path - fill_in 'project_name', :with => 'NewProject' - fill_in 'project_code', :with => 'NPR' - fill_in 'project_path', :with => 'newproject' - expect { click_button "Create project" }.to change { Project.count }.by(1) - @project = Project.last - end - - it "should be correct path" do - current_path.should == project_path(@project) - end - - it "should show project" do - page.should have_content(@project.name) - page.should have_content(@project.path) - page.should have_content(@project.description) - end - - it "should init repo instructions" do - page.should have_content("git remote") - page.should have_content(@project.url_to_repo) - end - end - describe "GET /projects/show" do before do @project = Factory :project, :owner => @user @@ -57,42 +16,6 @@ describe "Projects" do end end - describe "GET /projects/graph" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit graph_project_path(@project) - end - - it "should be correct path" do - current_path.should == graph_project_path(@project) - end - - it "should have as as team member" do - page.should have_content("master") - end - end - - describe "GET /projects/team" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit team_project_path(@project, - :path => ValidCommit::BLOB_FILE_PATH, - :commit_id => ValidCommit::ID) - end - - it "should be correct path" do - current_path.should == team_project_path(@project) - end - - it "should have as as team member" do - page.should have_content(@user.name) - end - end - describe "GET /projects/:id/edit" do before do @project = Factory :project diff --git a/spec/requests/projects_tree_spec.rb b/spec/requests/projects_tree_spec.rb deleted file mode 100644 index acc4f0b9..00000000 --- a/spec/requests/projects_tree_spec.rb +++ /dev/null @@ -1,90 +0,0 @@ -require 'spec_helper' - -describe "Projects" do - before { login_as :user } - - describe "GET /projects/tree" do - describe "head" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit tree_project_ref_path(@project, @project.root_ref) - end - - it "should be correct path" do - current_path.should == tree_project_ref_path(@project, @project.root_ref) - end - - it_behaves_like :tree_view - end - - describe ValidCommit::ID do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit tree_project_ref_path(@project, ValidCommit::ID) - end - - it "should be correct path" do - current_path.should == tree_project_ref_path(@project, ValidCommit::ID) - end - - it_behaves_like :tree_view - it_behaves_like :project_side_pane - end - - describe "branch passed" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit tree_project_ref_path(@project, @project.root_ref) - end - - it "should be correct path" do - current_path.should == tree_project_ref_path(@project, @project.root_ref) - end - - it_behaves_like :tree_view - it_behaves_like :project_side_pane - end - - # TREE FILE PREVIEW - describe "file preview" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile") - end - - it "should be correct path" do - current_path.should == tree_project_ref_path(@project, @project.root_ref) - end - - it "should contain file view" do - page.should have_content("rubygems.org") - end - end - end - - # RAW FILE - describe "GET /projects/blob" do - before do - @project = Factory :project - @project.add_access(@user, :read) - - visit blob_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) - end - - it "should be correct path" do - current_path.should == blob_project_ref_path(@project, ValidCommit::ID) - end - - it "raw file response" do - page.source.should == ValidCommit::BLOB_FILE - end - end -end diff --git a/spec/requests/projects_wall_spec.rb b/spec/requests/projects_wall_spec.rb deleted file mode 100644 index b2708fd1..00000000 --- a/spec/requests/projects_wall_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'spec_helper' - -describe "Projects", "Wall" do - let(:project) { Factory :project } - - before do - login_as :user - project.add_access(@user, :read, :write) - end - - describe "View notes on wall", :js => true do - before do - Factory :note, :project => project, :note => "Project specs", :author => @user - visit wall_project_path(project) - end - - it { page.should have_content("Project specs") } - it { page.should have_content(@user.name) } - it { page.should have_content("less than a minute ago") } - end - - describe "add new note", :js => true do - before do - visit wall_project_path(project) - fill_in "note_note", :with => "my post on wall" - click_button "Add Comment" - end - - it "should conatin new note" do - page.should have_content("my post on wall") - end - end -end diff --git a/spec/requests/wikis_spec.rb b/spec/requests/wikis_spec.rb deleted file mode 100644 index fd66b5e4..00000000 --- a/spec/requests/wikis_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'spec_helper' - -describe "Wiki" do - let(:project) { Factory :project } - - before do - login_as :user - project.add_access(@user, :read, :write) - end - - describe "Add pages" do - before do - visit project_wiki_path(project, :index) - end - - it "should see form" do - page.should have_content("Editing page") - end - - it "should see added page" do - fill_in "Title", :with => 'Test title' - fill_in "Content", :with => '[link test](test)' - click_on "Save" - - page.should have_content("Test title") - page.should have_content("link test") - - click_link "link test" - - page.should have_content("Editing page") - end - - end - -end From b846ac10597d832bd4b03ee65a026fcf4f9480f2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 3 Aug 2012 19:39:54 +0300 Subject: [PATCH 07/14] Milestones cucumber. Renamed app security test --- features/projects/issues/milestones.feature | 18 +++++++ .../project_merge_requests_steps.rb | 38 ++++++++++++++ ...ojects_security_spec.rb => access_spec.rb} | 2 +- spec/requests/milestones_spec.rb | 51 ------------------- 4 files changed, 57 insertions(+), 52 deletions(-) create mode 100644 features/step_definitions/project_merge_requests_steps.rb rename spec/requests/{projects_security_spec.rb => access_spec.rb} (99%) delete mode 100644 spec/requests/milestones_spec.rb diff --git a/features/projects/issues/milestones.feature b/features/projects/issues/milestones.feature index e69de29b..d78096a4 100644 --- a/features/projects/issues/milestones.feature +++ b/features/projects/issues/milestones.feature @@ -0,0 +1,18 @@ +Feature: Milestones + Background: + Given I signin as a user + And I own project "Shop" + And project "Shop" has milestone "v2.2" + Given I visit project "Shop" milestones page + + Scenario: I should see active milestones + Then I should see milestone "v2.2" + + Scenario: I should see milestone + Given I click link "v2.2" + Then I should see milestone "v2.2" + + Scenario: I create new milestone + Given I click link "New Milestone" + And I submit new milestone "v2.3" + Then I should see milestone "v2.3" diff --git a/features/step_definitions/project_merge_requests_steps.rb b/features/step_definitions/project_merge_requests_steps.rb new file mode 100644 index 00000000..6749773e --- /dev/null +++ b/features/step_definitions/project_merge_requests_steps.rb @@ -0,0 +1,38 @@ +Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + + milestone = Factory :milestone, + :title => arg2, + :project => project + + 3.times do |i| + issue = Factory :issue, + :project => project, + :milestone => milestone + end +end + +Given /^I visit project "(.*?)" milestones page$/ do |arg1| + @project = Project.find_by_name(arg1) + visit project_milestones_path(@project) +end + +Then /^I should see active milestones$/ do + milestone = @project.milestones.first + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") +end + +Then /^I should see milestone "(.*?)"$/ do |arg1| + milestone = @project.milestones.find_by_title(arg1) + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") +end + +Given /^I submit new milestone "(.*?)"$/ do |arg1| + fill_in "milestone_title", :with => arg1 + click_button "Create milestone" +end + diff --git a/spec/requests/projects_security_spec.rb b/spec/requests/access_spec.rb similarity index 99% rename from spec/requests/projects_security_spec.rb rename to spec/requests/access_spec.rb index df4d1122..bcca42f5 100644 --- a/spec/requests/projects_security_spec.rb +++ b/spec/requests/access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Projects Security" do +describe "Application access" do describe "GET /" do it { root_path.should be_allowed_for :admin } it { root_path.should be_allowed_for :user } diff --git a/spec/requests/milestones_spec.rb b/spec/requests/milestones_spec.rb deleted file mode 100644 index f1d5023e..00000000 --- a/spec/requests/milestones_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec_helper' - -describe "Milestones" do - let(:project) { Factory :project } - - before do - login_as :user - project.add_access(@user, :admin) - - @milestone = Factory :milestone, :project => project - @issue = Factory :issue, :project => project - - @milestone.issues << @issue - end - - describe "GET /milestones" do - before do - visit project_milestones_path(project) - end - - subject { page } - - it { should have_content(@milestone.title[0..10]) } - it { should have_content(@milestone.expires_at) } - it { should have_content("Browse Issues") } - end - - describe "GET /milestone/:id" do - before do - visit project_milestone_path(project, @milestone) - end - - subject { page } - - it { should have_content(@milestone.title[0..10]) } - it { should have_content(@milestone.expires_at) } - it { should have_content("Browse Issues") } - end - - describe "GET /milestones/new" do - before do - visit new_project_milestone_path(project) - fill_in "milestone_title", :with => "v2.3" - click_button "Create milestone" - end - - it { current_path.should == project_milestone_path(project, project.milestones.last) } - it { page.should have_content(project.milestones.last.title[0..10]) } - it { page.should have_content(project.milestones.last.expires_at) } - end -end From 1281c122c7a4edf2873aad13c22ea09ce6dc57c3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 3 Aug 2012 19:49:54 +0300 Subject: [PATCH 08/14] Issues cucumber. refactored step_definitoons --- features/projects/issues/issues.feature | 30 +++- .../{ => profile}/profile_keys_steps.rb | 0 .../{ => profile}/profile_steps.rb | 0 .../{ => project}/browse_code_steps.rb | 0 .../{ => project}/project_commits_steps.rb | 0 .../project/project_issues_steps.rb | 47 ++++++ .../project_merge_requests_steps.rb | 0 .../{ => project}/project_team_steps.rb | 0 .../{ => project}/project_wiki_steps.rb | 0 .../{ => project}/projects_steps.rb | 0 .../step_definitions/project_issues_steps.rb | 22 --- spec/requests/atom/issues_spec.rb | 40 +++++ spec/requests/issues_notes_spec.rb | 27 --- spec/requests/issues_spec.rb | 155 ------------------ 14 files changed, 115 insertions(+), 206 deletions(-) rename features/step_definitions/{ => profile}/profile_keys_steps.rb (100%) rename features/step_definitions/{ => profile}/profile_steps.rb (100%) rename features/step_definitions/{ => project}/browse_code_steps.rb (100%) rename features/step_definitions/{ => project}/project_commits_steps.rb (100%) create mode 100644 features/step_definitions/project/project_issues_steps.rb rename features/step_definitions/{ => project}/project_merge_requests_steps.rb (100%) rename features/step_definitions/{ => project}/project_team_steps.rb (100%) rename features/step_definitions/{ => project}/project_wiki_steps.rb (100%) rename features/step_definitions/{ => project}/projects_steps.rb (100%) delete mode 100644 features/step_definitions/project_issues_steps.rb create mode 100644 spec/requests/atom/issues_spec.rb delete mode 100644 spec/requests/issues_notes_spec.rb diff --git a/features/projects/issues/issues.feature b/features/projects/issues/issues.feature index 0ca0792d..a45dd801 100644 --- a/features/projects/issues/issues.feature +++ b/features/projects/issues/issues.feature @@ -7,6 +7,32 @@ Feature: Issues And I visit project "Shop" issues page Scenario: I should see open issues - Given I should see "Release 0.4" open issue - And I should not see "Release 0.3" closed issue + Given I should see "Release 0.4" in issues + And I should not see "Release 0.3" in issues + Scenario: I should see closed issues + Given I click link "Closed" + Then I should see "Release 0.3" in issues + And I should not see "Release 0.4" in issues + + Scenario: I should see all issues + Given I click link "All" + Then I should see "Release 0.3" in issues + And I should see "Release 0.4" in issues + + Scenario: I visit issue page + Given I click link "Release 0.4" + Then I should see issue "Release 0.4" + + @javascript + Scenario: I submit new unassigned issue + Given I click link "New Issue" + And I submit new issue "500 error on profile" + Given I click link "500 error on profile" + Then I should see issue "500 error on profile" + + @javascript + 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" diff --git a/features/step_definitions/profile_keys_steps.rb b/features/step_definitions/profile/profile_keys_steps.rb similarity index 100% rename from features/step_definitions/profile_keys_steps.rb rename to features/step_definitions/profile/profile_keys_steps.rb diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile/profile_steps.rb similarity index 100% rename from features/step_definitions/profile_steps.rb rename to features/step_definitions/profile/profile_steps.rb diff --git a/features/step_definitions/browse_code_steps.rb b/features/step_definitions/project/browse_code_steps.rb similarity index 100% rename from features/step_definitions/browse_code_steps.rb rename to features/step_definitions/project/browse_code_steps.rb diff --git a/features/step_definitions/project_commits_steps.rb b/features/step_definitions/project/project_commits_steps.rb similarity index 100% rename from features/step_definitions/project_commits_steps.rb rename to features/step_definitions/project/project_commits_steps.rb diff --git a/features/step_definitions/project/project_issues_steps.rb b/features/step_definitions/project/project_issues_steps.rb new file mode 100644 index 00000000..2c47f372 --- /dev/null +++ b/features/step_definitions/project/project_issues_steps.rb @@ -0,0 +1,47 @@ +Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) +end + +Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) +end + +Given /^I visit project "(.*?)" issues page$/ do |arg1| + visit project_issues_path(Project.find_by_name(arg1)) +end + +Given /^I should see "(.*?)" in issues$/ do |arg1| + page.should have_content arg1 +end + +Given /^I should not see "(.*?)" in issues$/ do |arg1| + page.should_not have_content arg1 +end + +Then /^I should see issue "(.*?)"$/ do |arg1| + issue = Issue.find_by_title(arg1) + page.should have_content issue.title + page.should have_content issue.author_name + page.should have_content issue.project.name +end + +Given /^I visit issue page "(.*?)"$/ do |arg1| + issue = Issue.find_by_title(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" +end diff --git a/features/step_definitions/project_merge_requests_steps.rb b/features/step_definitions/project/project_merge_requests_steps.rb similarity index 100% rename from features/step_definitions/project_merge_requests_steps.rb rename to features/step_definitions/project/project_merge_requests_steps.rb diff --git a/features/step_definitions/project_team_steps.rb b/features/step_definitions/project/project_team_steps.rb similarity index 100% rename from features/step_definitions/project_team_steps.rb rename to features/step_definitions/project/project_team_steps.rb diff --git a/features/step_definitions/project_wiki_steps.rb b/features/step_definitions/project/project_wiki_steps.rb similarity index 100% rename from features/step_definitions/project_wiki_steps.rb rename to features/step_definitions/project/project_wiki_steps.rb diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/project/projects_steps.rb similarity index 100% rename from features/step_definitions/projects_steps.rb rename to features/step_definitions/project/projects_steps.rb diff --git a/features/step_definitions/project_issues_steps.rb b/features/step_definitions/project_issues_steps.rb deleted file mode 100644 index e83c0e7f..00000000 --- a/features/step_definitions/project_issues_steps.rb +++ /dev/null @@ -1,22 +0,0 @@ -Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) -end - -Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) -end - -Given /^I visit project "(.*?)" issues page$/ do |arg1| - visit project_issues_path(Project.find_by_name(arg1)) -end - -Given /^I should see "(.*?)" open issue$/ do |arg1| - page.should have_content arg1 -end - -Given /^I should not see "(.*?)" closed issue$/ do |arg1| - page.should_not have_content arg1 -end - diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb new file mode 100644 index 00000000..8d0b6c4f --- /dev/null +++ b/spec/requests/atom/issues_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe "Issues" do + let(:project) { Factory :project } + + before do + login_as :user + project.add_access(@user, :read, :write) + end + + describe "GET /issues" do + before do + @issue = Factory :issue, + :author => @user, + :assignee => @user, + :project => project + + visit project_issues_path(project) + end + + it "should render atom feed" do + visit project_issues_path(project, :atom) + + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "#{project.name} issues") + page.body.should have_selector("author email", :text => @issue.author_email) + page.body.should have_selector("entry summary", :text => @issue.title) + end + + it "should render atom feed via private token" do + logout + visit project_issues_path(project, :atom, :private_token => @user.private_token) + + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "#{project.name} issues") + page.body.should have_selector("author email", :text => @issue.author_email) + page.body.should have_selector("entry summary", :text => @issue.title) + end + end +end diff --git a/spec/requests/issues_notes_spec.rb b/spec/requests/issues_notes_spec.rb deleted file mode 100644 index 538098e6..00000000 --- a/spec/requests/issues_notes_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'spec_helper' - -describe "Issues" do - let(:project) { Factory :project } - - before do - login_as :user - project.add_access(@user, :read, :write) - - @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - end - - describe "add new note", :js => true do - before do - visit project_issue_path(project, @issue) - fill_in "note_note", :with => "I commented this issue" - click_button "Add Comment" - end - - it "should conatin new note" do - page.should have_content("I commented this issue") - end - end -end diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 2c8650a8..ad7b0432 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -11,161 +11,6 @@ describe "Issues" do project.add_access(@user2, :read, :write) end - describe "GET /issues" do - before do - @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - - visit project_issues_path(project) - end - - subject { page } - - it { should have_content(@issue.title[0..20]) } - it { should have_content(@issue.project.name) } - it { should have_content(@issue.assignee.name) } - - it "should render atom feed" do - visit project_issues_path(project, :atom) - - page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) - end - - it "should render atom feed via private token" do - logout - visit project_issues_path(project, :atom, :private_token => @user.private_token) - - page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) - end - - describe "statuses" do - before do - @closed_issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project, - :closed => true - end - - it "should show only open" do - should have_content(@issue.title[0..25]) - should have_no_content(@closed_issue.title) - end - - it "should show only closed" do - click_link "Closed" - should have_no_content(@issue.title) - should have_content(@closed_issue.title[0..25]) - end - - it "should show all" do - click_link "All" - should have_content(@issue.title[0..25]) - should have_content(@closed_issue.title[0..25]) - end - end - end - - describe "New issue", :js => true do - before do - visit project_issues_path(project) - click_link "New Issue" - end - - it "should open new issue form" do - page.should have_content("New Issue") - end - - describe "fill in" do - describe 'assign to me' do - before do - fill_in "issue_title", :with => "bug 345" - page.execute_script("$('#issue_assignee_id').show();") - select @user.name, :from => "issue_assignee_id" - end - - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) } - - it "should add new issue to table" do - click_button "Submit new issue" - - page.should_not have_content("Add new issue") - page.should have_content @user.name - page.should have_content "bug 345" - page.should have_content project.name - end - - it "should call send mail" do - Notify.should_not_receive(:new_issue_email) - click_button "Submit new issue" - end - end - - describe 'assign to other' do - before do - fill_in "issue_title", :with => "bug 345" - page.execute_script("$('#issue_assignee_id').show();") - select @user2.name, :from => "issue_assignee_id" - end - - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) } - - it "should add new issue to table" do - click_button "Submit new issue" - - page.should_not have_content("Add new issue") - page.should have_content @user2.name - page.should have_content "bug 345" - page.should have_content project.name - end - - it "should call send mail" do - Issue.observers.enable :issue_observer do - Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) - click_button "Submit new issue" - end - end - - it "should send valid email to user" do - Issue.observers.enable :issue_observer do - with_resque do - click_button "Submit new issue" - end - issue = Issue.last - email = ActionMailer::Base.deliveries.last - email.subject.should have_content("New Issue was created") - email.body.should have_content(issue.title) - end - end - - end - end - end - - describe "Show issue" do - before do - @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - - visit project_issue_path(project, @issue) - end - - it "should have valid show page for issue" do - page.should have_content @issue.title - page.should have_content @user.name - end - end - describe "Edit issue", :js => true do before do @issue = Factory :issue, From 9844ddd43f20e84754759688fea39e1a0241bb06 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 3 Aug 2012 19:59:55 +0300 Subject: [PATCH 09/14] Comments cucumber. More refactoring. Cucumber -> branches, tags --- features/projects/commits/branches.feature | 12 +++- .../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 ++ .../project/project_commits_steps.rb | 27 ++++++++ .../project/project_issues_steps.rb | 9 --- .../project/projects_steps.rb | 14 ++++ spec/monkeypatch.rb | 6 +- spec/requests/commits_notes_spec.rb | 28 -------- spec/requests/repositories_spec.rb | 49 ------------- .../profile_access_spec.rb} | 3 - .../project_access_spec.rb} | 0 spec/requests/team_members_spec.rb | 68 ------------------- spec/requests/wikis_notes_spec.rb | 29 -------- 16 files changed, 80 insertions(+), 192 deletions(-) create mode 100644 features/projects/project.feature delete mode 100644 spec/requests/commits_notes_spec.rb delete mode 100644 spec/requests/repositories_spec.rb rename spec/requests/{user_security_spec.rb => security/profile_access_spec.rb} (84%) rename spec/requests/{access_spec.rb => security/project_access_spec.rb} (100%) delete mode 100644 spec/requests/team_members_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 2b136e1b..74575c51 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 bdf47b88..9bd56d29 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 81221748..f7899fc3 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 a45dd801..180710cf 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 00000000..895a928f --- /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 ed69e87c..4441ada2 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 9b3b0aa1..35fcb4d1 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 2c47f372..00a1721f 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 bca12139..c9af346e 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 6133631c..93dda017 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/commits_notes_spec.rb b/spec/requests/commits_notes_spec.rb deleted file mode 100644 index fde42a8f..00000000 --- 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 1bf4c8d2..00000000 --- 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/user_security_spec.rb b/spec/requests/security/profile_access_spec.rb similarity index 84% rename from spec/requests/user_security_spec.rb rename to spec/requests/security/profile_access_spec.rb index b75a1779..b8ed27f0 100644 --- a/spec/requests/user_security_spec.rb +++ b/spec/requests/security/profile_access_spec.rb @@ -7,9 +7,6 @@ describe "Users Security" do 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 diff --git a/spec/requests/access_spec.rb b/spec/requests/security/project_access_spec.rb similarity index 100% rename from spec/requests/access_spec.rb rename to spec/requests/security/project_access_spec.rb diff --git a/spec/requests/team_members_spec.rb b/spec/requests/team_members_spec.rb deleted file mode 100644 index 34e34f59..00000000 --- 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/wikis_notes_spec.rb b/spec/requests/wikis_notes_spec.rb deleted file mode 100644 index 144d0318..00000000 --- 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 From 4a437cdf860880e45614f8afaeb6156f1c917f79 Mon Sep 17 00:00:00 2001 From: randx Date: Thu, 2 Aug 2012 09:05:00 +0300 Subject: [PATCH 10/14] Remove useless Protected branch test --- spec/models/protected_branch_spec.rb | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index becc1be4..6724fb8d 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -37,19 +37,6 @@ describe ProtectedBranch do end end - describe '#update_repository' do - let(:gitolite) { mock } - - subject { ProtectedBranch.new(:project => project) } - - it "updates the branch's project repo permissions" do - Gitlab::GitHost.should_receive(:system).and_return(gitolite) - gitolite.should_receive(:update_project).with(project.path, project) - - subject.update_repository - end - end - describe '#commit' do subject { ProtectedBranch.new(:project => project, :name => 'cant_touch_this') } From 9b4c41f826151bbad4a3dbb42b892f250f8901b5 Mon Sep 17 00:00:00 2001 From: randx Date: Thu, 2 Aug 2012 09:07:01 +0300 Subject: [PATCH 11/14] Fix github issue #1190 --- app/assets/stylesheets/sections/nav.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss index 93df4193..4a773644 100644 --- a/app/assets/stylesheets/sections/nav.scss +++ b/app/assets/stylesheets/sections/nav.scss @@ -14,6 +14,7 @@ ul.main_menu { background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); position:relative; + overflow:hidden; @include shade; .count { position: relative; From 9bf7c1ee319496f5cb7f138ca6c82aa167d02864 Mon Sep 17 00:00:00 2001 From: randx Date: Sat, 4 Aug 2012 10:13:54 +0300 Subject: [PATCH 12/14] Fix travis script --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 402fc8e0..f3ede12f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ env: before_install: - sudo apt-get install libicu-dev -y - gem install charlock_holmes -v="0.6.8" - - echo "yes" | gem uninstall json ffi branches: only: - 'master' From 7dd276817c6459e0fdf6524f1b8e51decd385986 Mon Sep 17 00:00:00 2001 From: randx Date: Thu, 2 Aug 2012 09:48:24 +0300 Subject: [PATCH 13/14] Rack mini profiler for dev env --- Gemfile | 1 + Gemfile.lock | 3 +++ app/controllers/application_controller.rb | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/Gemfile b/Gemfile index 8db7d813..f9eaa6f1 100644 --- a/Gemfile +++ b/Gemfile @@ -60,6 +60,7 @@ group :development do gem "letter_opener" gem "rails-footnotes" gem "annotate", :git => "https://github.com/ctran/annotate_models.git" + gem 'rack-mini-profiler' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index f3a93096..ee8c8c8c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -237,6 +237,8 @@ GEM rack (1.4.1) rack-cache (1.2) rack (>= 0.4) + rack-mini-profiler (0.1.9) + rack (>= 1.1.3) rack-mount (0.8.3) rack (>= 1.0.0) rack-protection (1.2.0) @@ -408,6 +410,7 @@ DEPENDENCIES omniauth-ldap! pry pygments.rb! + rack-mini-profiler rails (= 3.2.5) rails-footnotes raphael-rails (= 1.5.2) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3265046d..7ea9f320 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base before_filter :set_current_user_for_mailer before_filter :check_token_auth before_filter :set_current_user_for_observers + before_filter :dev_tools if Rails.env == 'development' protect_from_forgery @@ -142,4 +143,8 @@ class ApplicationController < ActionController::Base def render_full_content @full_content = true end + + def dev_tools + Rack::MiniProfiler.authorize_request + end end From c120457a6f723167cece9b8cd4bde8197de167f7 Mon Sep 17 00:00:00 2001 From: randx Date: Thu, 2 Aug 2012 15:30:22 +0300 Subject: [PATCH 14/14] Add admin credentials to installation docs --- doc/installation.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/installation.md b/doc/installation.md index cb54663e..43b2c310 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -195,6 +195,11 @@ Application can be started with next command: # As daemon sudo -u gitlab bundle exec rails s -e production -d +You can login via web using admin generated with setup: + + admin@local.host + 5iveL!fe + # 6. Run resque process (for processing queue). # Manually