[#345] replace owner_with_name to name_with_owner

This commit is contained in:
Alexander Machehin 2014-03-19 13:19:03 +06:00
parent d013d8c138
commit d7a3f629e8
14 changed files with 92 additions and 92 deletions

View File

@ -12,7 +12,7 @@ class Projects::BaseController < ApplicationController
end
def find_project
@project = Project.find_by_owner_and_name! params[:owner_with_name]
@project = Project.find_by_owner_and_name! params[:name_with_owner]
end
def init_statistics

View File

@ -292,7 +292,7 @@ Rosa::Application.routes.draw do
get :mass_import
end
end
scope ':owner_with_name', constraints: { owner_with_name: Project::OWNER_AND_NAME_REGEXP } do # project
scope ':name_with_owner', constraints: { name_with_owner: Project::OWNER_AND_NAME_REGEXP } do # project
scope as: 'project' do
resources :wiki do
collection do

View File

@ -32,7 +32,7 @@ shared_examples_for "api projects user without show rights" do
end
it "should access violation instead of project data by get_id" do
get :get_id, owner_with_name: @project.name_with_owner, format: :json
get :get_id, name_with_owner: @project.name_with_owner, format: :json
response.should_not be_success
end
@ -98,17 +98,17 @@ shared_examples_for "api projects user with show rights" do
context 'project find by get_id' do
it "should find project by name and owner name" do
@project.reload
get :get_id, owner_with_name: @project.name_with_owner, format: :json
get :get_id, name_with_owner: @project.name_with_owner, format: :json
assigns[:project].id.should == @project.id
end
it "should not find project by non existing name and owner name" do
get :get_id, owner_with_name: "#{@project.owner_uname}/NONE_EXISTING_NAME", format: :json
get :get_id, name_with_owner: "#{@project.owner_uname}/NONE_EXISTING_NAME", format: :json
assigns[:project].should be_blank
end
it "should render 404 for non existing name and owner name" do
get :get_id, owner_with_name: "#{@project.owner_uname}/NONE_EXISTING_NAME", format: :json
get :get_id, name_with_owner: "#{@project.owner_uname}/NONE_EXISTING_NAME", format: :json
response.body.should == {status: 404, message: I18n.t("flash.404_message")}.to_json
end
end

View File

@ -9,7 +9,7 @@ describe Projects::BuildListsController do
end
it 'should be able to perform index action in project scope' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should be_success
end
end
@ -21,7 +21,7 @@ describe Projects::BuildListsController do
end
it 'should not be able to perform index action in project scope' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(forbidden_url)
end
end
@ -32,32 +32,32 @@ describe Projects::BuildListsController do
}
it 'should be able to perform new action' do
get :new, owner_with_name: @project.name_with_owner
get :new, name_with_owner: @project.name_with_owner
response.should render_template(:new)
end
it 'should be able to perform create action' do
post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params)
post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params)
response.should redirect_to project_build_lists_path(@project)
end
it 'should save correct commit_hash for branch based build' do
post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { project_version: "master" })
post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { project_version: "master" })
@project.build_lists.last.commit_hash.should == @project.repo.commits('master').first.id
end
it 'should save correct commit_hash for tag based build' do
system("cd #{@project.repo.path} && git tag 4.7.5.3") # TODO REDO through grit
post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { project_version: "4.7.5.3" })
post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { project_version: "4.7.5.3" })
@project.build_lists.last.commit_hash.should == @project.repo.commits('4.7.5.3').first.id
end
it 'should not be able to create with wrong project version' do
lambda{ post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { project_version: "wrong", commit_hash: nil })}.should change{ @project.build_lists.count }.by(0)
lambda{ post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { project_version: "wrong", commit_hash: nil })}.should change{ @project.build_lists.count }.by(0)
end
it 'should not be able to create with wrong git hash' do
lambda{ post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { commit_hash: 'wrong' }) }.should change{ @project.build_lists.count }.by(0)
lambda{ post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params).deep_merge(build_list: { commit_hash: 'wrong' }) }.should change{ @project.build_lists.count }.by(0)
end
end
@ -67,12 +67,12 @@ describe Projects::BuildListsController do
}
it 'should not be able to perform new action' do
get :new, owner_with_name: @project.name_with_owner
get :new, name_with_owner: @project.name_with_owner
response.should redirect_to(forbidden_url)
end unless skip_new
it 'should not be able to perform create action' do
post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params)
post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params)
response.should redirect_to(forbidden_url)
end
end
@ -119,7 +119,7 @@ describe Projects::BuildListsController do
@user = FactoryGirl.create(:user)
set_session_for(@user)
@show_params = { owner_with_name: @project.name_with_owner, id: @build_list.id }
@show_params = { name_with_owner: @project.name_with_owner, id: @build_list.id }
@build_list.save_to_repository.update_column(:publish_without_qa, false)
@request.env['HTTP_REFERER'] = build_list_path(@build_list)
end
@ -315,7 +315,7 @@ describe Projects::BuildListsController do
create_actor_relation(@member_group, @member_user, 'reader')
create_relation(@project, @member_group, 'reader')
@show_params = { owner_with_name: @project.name_with_owner, id: @build_list.id }
@show_params = { name_with_owner: @project.name_with_owner, id: @build_list.id }
end
context 'for all build lists' do

View File

@ -24,7 +24,7 @@ shared_context "collaborators controller" do
role: 'reader'
} if @group
@create_params = {
owner_with_name: @project.name_with_owner,
name_with_owner: @project.name_with_owner,
format: :json
}
@update_params = @create_params.merge(collaborator: { role: 'reader' })
@ -33,7 +33,7 @@ end
shared_examples_for 'project admin user' do
it 'should be able to view collaborators list' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should be_success
end
@ -60,7 +60,7 @@ end
shared_examples_for 'user with no rights for this project' do
it 'should not be able to view collaborators list' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(forbidden_path)
end
@ -83,7 +83,7 @@ describe Projects::CollaboratorsController do
set_session_for(User.new)
end
it 'should not be able to perform index action' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(new_user_session_path)
end

View File

@ -6,15 +6,15 @@ describe Projects::CommentsController do
@project = FactoryGirl.create(:project_with_commit)
@commit = @project.repo.commits.first
@create_params = { comment: { body: 'I am a comment!' }, owner_with_name: @project.name_with_owner, commit_id: @commit.id }
@update_params = { comment: { body: 'updated' }, owner_with_name: @project.name_with_owner, commit_id: @commit.id }
@create_params = { comment: { body: 'I am a comment!' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id }
@update_params = { comment: { body: 'updated' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id }
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
@comment = FactoryGirl.create(:comment, commentable: @commit, project: @project)
@user = FactoryGirl.create(:user)
@own_comment = FactoryGirl.create(:comment, commentable: @commit, user: @user, project: @project)
set_session_for(@user)
@path = { owner_with_name: @project.name_with_owner, commit_id: @commit.id }
@path = { name_with_owner: @project.name_with_owner, commit_id: @commit.id }
@return_path = commit_path(@project, @commit.id)
end

View File

@ -13,7 +13,7 @@ shared_context "comments controller" do
set_session_for(@user)
@path = { owner_with_name: @project.name_with_owner, issue_id: @issue.serial_id }
@path = { name_with_owner: @project.name_with_owner, issue_id: @issue.serial_id }
@return_path = project_issue_path(@project, @issue)
@create_params = { comment: { body: 'I am a comment!' }}.merge(@path)
@update_params = { comment: { body: 'updated' }}.merge(@path)

View File

@ -6,7 +6,7 @@ describe Projects::Git::TreesController do
stub_symlink_methods
@project = FactoryGirl.create(:project)
@params = { owner_with_name: @project.name_with_owner, treeish: "#{@project.name}-master" }
@params = { name_with_owner: @project.name_with_owner, treeish: "#{@project.name}-master" }
fill_project @project
end

View File

@ -2,54 +2,54 @@ require 'spec_helper'
shared_examples_for 'hooks user with project admin rights' do
it 'should be able to perform index action' do
get :index, {owner_with_name: "#{@project.owner.uname}/#{@project.name}"}
get :index, {name_with_owner: "#{@project.owner.uname}/#{@project.name}"}
response.should be_success
end
it 'should be able to perform new action' do
get :new, { owner_with_name: @project.name_with_owner, hook: { name: 'web' }}
get :new, { name_with_owner: @project.name_with_owner, hook: { name: 'web' }}
response.should be_success
end
it 'should be able to perform edit action' do
get :new, { owner_with_name: @project.name_with_owner, id: @hook.id }
get :new, { name_with_owner: @project.name_with_owner, id: @hook.id }
response.should be_success
end
it 'should be able to perform update action' do
put :update, { owner_with_name: @project.name_with_owner, id: @hook.id }.merge(@update_params)
put :update, { name_with_owner: @project.name_with_owner, id: @hook.id }.merge(@update_params)
response.should redirect_to(project_hooks_path(@project, name: 'web'))
end
it 'should be able to perform create action' do
post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params)
post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params)
response.should redirect_to(project_hooks_path(@project, name: 'web'))
end
end
shared_examples_for 'hooks user without project admin rights' do
it 'should not be able to perform index action' do
get :index, { owner_with_name: @project.name_with_owner }
get :index, { name_with_owner: @project.name_with_owner }
response.should redirect_to(forbidden_path)
end
it 'should not be able to perform new action' do
get :new, { owner_with_name: @project.name_with_owner, hook: { name: 'web' }}
get :new, { name_with_owner: @project.name_with_owner, hook: { name: 'web' }}
response.should redirect_to(forbidden_path)
end
it 'should not be able to perform edit action' do
get :new, { owner_with_name: @project.name_with_owner, id: @hook.id }
get :new, { name_with_owner: @project.name_with_owner, id: @hook.id }
response.should redirect_to(forbidden_path)
end
it 'should not be able to perform update action' do
put :update, { owner_with_name: @project.name_with_owner, id: @hook.id }.merge(@update_params)
put :update, { name_with_owner: @project.name_with_owner, id: @hook.id }.merge(@update_params)
response.should redirect_to(forbidden_path)
end
it 'should not be able to perform create action' do
post :create, { owner_with_name: @project.name_with_owner }.merge(@create_params)
post :create, { name_with_owner: @project.name_with_owner }.merge(@create_params)
response.should redirect_to(forbidden_path)
end
end

View File

@ -17,7 +17,7 @@ shared_context "issues controller" do
set_session_for(@user)
@create_params = {
owner_with_name: @project.name_with_owner,
name_with_owner: @project.name_with_owner,
issue: {
title: "issue1",
body: "issue body",
@ -26,7 +26,7 @@ shared_context "issues controller" do
}
}
@update_params = { owner_with_name: @project.name_with_owner, issue: { title: "issue2" }}
@update_params = { name_with_owner: @project.name_with_owner, issue: { title: "issue2" }}
@pull = @project.pull_requests.new issue_attributes: { title: 'test', body: 'testing' }
@pull.issue.user, @pull.issue.project = @project.owner, @pull.to_project
@ -39,12 +39,12 @@ end
shared_examples_for 'issue user with project guest rights' do
it 'should be able to perform index action' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should render_template(:index)
end
it 'should be able to perform show action' do
get :show, owner_with_name: @project.name_with_owner, id: @issue.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @issue.serial_id
response.should render_template(:show)
end
end
@ -53,7 +53,7 @@ shared_examples_for 'issue user with project reader rights' do
it 'should be able to perform index action on hidden project' do
@project.update_attributes(visibility: 'hidden')
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should render_template(:index)
end
@ -70,7 +70,7 @@ end
shared_examples_for 'issue user with project writer rights' do
it 'should be able to perform index action on hidden project' do
@project.update_attributes(visibility: 'hidden')
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should render_template(:index)
end
@ -117,23 +117,23 @@ end
shared_examples_for 'user without issue destroy rights' do
it 'should not be able to perform destroy action' do
delete :destroy, id: @issue.serial_id, owner_with_name: @project.name_with_owner
delete :destroy, id: @issue.serial_id, name_with_owner: @project.name_with_owner
response.should redirect_to(controller.current_user ? forbidden_path : new_user_session_path)
end
it 'should not reduce issues count' do
lambda{ delete :destroy, id: @issue.serial_id, owner_with_name: @project.name_with_owner }.should_not change{ Issue.count }
lambda{ delete :destroy, id: @issue.serial_id, name_with_owner: @project.name_with_owner }.should_not change{ Issue.count }
end
end
shared_examples_for 'project with issues turned off' do
it 'should not be able to perform index action' do
get :index, owner_with_name: @project_with_turned_off_issues.name_with_owner
get :index, name_with_owner: @project_with_turned_off_issues.name_with_owner
response.should redirect_to(forbidden_path)
end
it 'should not be able to perform show action' do
get :show, owner_with_name: @project_with_turned_off_issues.name_with_owner, id: @turned_of_issue.serial_id
get :show, name_with_owner: @project_with_turned_off_issues.name_with_owner, id: @turned_of_issue.serial_id
response.should redirect_to(forbidden_path)
end
end
@ -215,12 +215,12 @@ describe Projects::IssuesController do
# end
it 'should return 404' do
get :show, owner_with_name: @project.name_with_owner, id: 999999
get :show, name_with_owner: @project.name_with_owner, id: 999999
render_template(file: "#{Rails.root}/public/404.html")
end
it 'should redirect to pull request page' do
get :show, owner_with_name: @project.name_with_owner, id: @pull.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @pull.serial_id
response.should redirect_to(project_pull_request_path(@project, @pull))
end
end
@ -260,24 +260,24 @@ describe Projects::IssuesController do
it 'should not be able to perform index action on hidden project' do
@project.update_attributes(visibility: 'hidden')
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(forbidden_path)
end
else
it 'should not be able to perform index action' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(new_user_session_path)
end
it 'should not be able to perform show action' do
get :show, owner_with_name: @project.name_with_owner, id: @issue.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @issue.serial_id
response.should redirect_to(new_user_session_path)
end
it 'should not be able to perform index action on hidden project' do
@project.update_attributes(visibility: 'hidden')
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(new_user_session_path)
end
end

View File

@ -3,67 +3,67 @@ require 'spec_helper'
shared_examples_for 'projects user with reader rights' do
it 'should be able to fork project' do
post :fork, owner_with_name: @project.name_with_owner
post :fork, name_with_owner: @project.name_with_owner
response.should redirect_to(project_path(Project.last))
end
it 'should be able to fork project to their group' do
group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'admin')
lambda { post :fork, owner_with_name: @project.name_with_owner,
lambda { post :fork, name_with_owner: @project.name_with_owner,
group: group.id }.should change{ Project.count }.by(1)
end
it 'should be able to fork project to own group' do
group = FactoryGirl.create(:group, owner: @user)
lambda { post :fork, owner_with_name: @project.name_with_owner,
lambda { post :fork, name_with_owner: @project.name_with_owner,
group: group.id }.should change{ Project.count }.by(1)
end
it 'should be able to fork project with different name' do
post :fork, owner_with_name: @project.name_with_owner, fork_name: 'another_name'
post :fork, name_with_owner: @project.name_with_owner, fork_name: 'another_name'
response.should redirect_to(project_path(Project.where(name: 'another_name').last))
end
end
shared_examples_for 'projects user with project admin rights' do
it 'should be able to perform update action' do
put :update, { owner_with_name: @project.name_with_owner }.merge(@update_params)
put :update, { name_with_owner: @project.name_with_owner }.merge(@update_params)
response.should redirect_to(project_path(@project))
end
it 'should be able to perform schedule action' do
put :schedule, { owner_with_name: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
put :schedule, { name_with_owner: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
response.should be_success
end
end
shared_examples_for 'user with destroy rights' do
it 'should be able to perform destroy action' do
delete :destroy, { owner_with_name: @project.name_with_owner }
delete :destroy, { name_with_owner: @project.name_with_owner }
response.should redirect_to(@project.owner)
end
it 'should change objects count on destroy' do
lambda { delete :destroy, owner_with_name: @project.name_with_owner }.should change{ Project.count }.by(-1)
lambda { delete :destroy, name_with_owner: @project.name_with_owner }.should change{ Project.count }.by(-1)
end
end
shared_examples_for 'projects user without project admin rights' do
it 'should not be able to edit project' do
description = @project.description
put :update, project: { description:"hack" }, owner_with_name: @project.name_with_owner
put :update, project: { description:"hack" }, name_with_owner: @project.name_with_owner
@project.reload.description.should == description
response.should redirect_to(forbidden_path)
end
it 'should not be able to perform schedule action' do
put :schedule, { owner_with_name: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
put :schedule, { name_with_owner: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
response.should redirect_to(forbidden_path)
end
it 'should not be able to edit project sections' do
has_wiki, has_issues = @project.has_wiki, @project.has_issues
post :sections, project: { has_wiki: !has_wiki, has_issues: !has_issues }, owner_with_name: @project.name_with_owner
post :sections, project: { has_wiki: !has_wiki, has_issues: !has_issues }, name_with_owner: @project.name_with_owner
@project.reload.has_wiki.should == has_wiki
@project.reload.has_issues.should == has_issues
response.should redirect_to(forbidden_path)
@ -72,14 +72,14 @@ shared_examples_for 'projects user without project admin rights' do
it 'writer group should be able to fork project to their group' do
group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'writer')
lambda { post :fork, owner_with_name: @project.name_with_owner,
lambda { post :fork, name_with_owner: @project.name_with_owner,
group: group.id }.should change{ Project.count }.by(1)
end
it 'reader group should not be able to fork project to their group' do
group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'reader')
lambda { post :fork, owner_with_name: @project.name_with_owner,
lambda { post :fork, name_with_owner: @project.name_with_owner,
group: group.id }.should change{ Project.count }.by(0)
end
@ -124,12 +124,12 @@ describe Projects::ProjectsController do
end
it 'should not be able to perform update action' do
put :update, { owner_with_name: @project.name_with_owner }.merge(@update_params)
put :update, { name_with_owner: @project.name_with_owner }.merge(@update_params)
response.should redirect_to(new_user_session_path)
end
it 'should not be able to perform schedule action' do
put :schedule, { owner_with_name: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
put :schedule, { name_with_owner: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
response.should redirect_to(new_user_session_path)
end
@ -207,7 +207,7 @@ describe Projects::ProjectsController do
it_should_behave_like 'user with destroy rights'
it 'should not be able to fork own project' do
post :fork, owner_with_name: @project.name_with_owner
post :fork, name_with_owner: @project.name_with_owner
response.should redirect_to(@project)
end
@ -236,7 +236,7 @@ describe Projects::ProjectsController do
it 'should not be able to fork hidden project' do
@project.update_attributes(visibility: 'hidden')
post :fork, owner_with_name: @project.name_with_owner
post :fork, name_with_owner: @project.name_with_owner
response.should redirect_to(forbidden_path)
end

View File

@ -19,7 +19,7 @@ shared_context "pull request controller" do
to_ref: 'non_conflicts',
from_ref: 'master' },
to_project: @project.name_with_owner,
owner_with_name: @project.name_with_owner
name_with_owner: @project.name_with_owner
}
@update_params = @create_params.merge(pull_request_action: 'close', id: @pull.serial_id)
@wrong_update_params = @create_params.merge(
@ -36,13 +36,13 @@ end
shared_examples_for 'pull request user with project guest rights' do
it 'should be able to perform index action' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should render_template(:index)
end
it 'should be able to perform show action when pull request has been created' do
@pull.check
get :show, owner_with_name: @project.name_with_owner, id: @pull.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @pull.serial_id
response.should render_template(:show)
end
end
@ -50,7 +50,7 @@ end
shared_examples_for 'pull request user with project reader rights' do
it 'should be able to perform index action on hidden project' do
@project.update_attributes(visibility: 'hidden')
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should render_template(:index)
end
@ -162,13 +162,13 @@ end
shared_examples_for 'pull request when project with issues turned off' do
before { @project.update_attributes(has_issues: false) }
it 'should be able to perform index action' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should render_template(:index)
end
it 'should be able to perform show action when pull request has been created' do
@pull.check
get :show, owner_with_name: @project.name_with_owner, id: @pull.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @pull.serial_id
response.should render_template(:show)
end
end
@ -222,12 +222,12 @@ describe Projects::PullRequestsController do
it_should_behave_like 'pull request when project with issues turned off'
it 'should return 404' do
get :show, owner_with_name: @project.name_with_owner, id: 999999
get :show, name_with_owner: @project.name_with_owner, id: 999999
render_template(file: "#{Rails.root}/public/404.html")
end
it 'should redirect to issue page' do
get :show, owner_with_name: @project.name_with_owner, id: @issue.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @issue.serial_id
response.should redirect_to(project_issue_path(@project, @issue))
end
end
@ -267,19 +267,19 @@ describe Projects::PullRequestsController do
else
it 'should not be able to perform index action' do
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(new_user_session_path)
end
it 'should not be able to perform show action' do
@pull.check
get :show, owner_with_name: @project.name_with_owner, id: @pull.serial_id
get :show, name_with_owner: @project.name_with_owner, id: @pull.serial_id
response.should redirect_to(new_user_session_path)
end
it 'should not be able to perform index action on hidden project' do
@project.update_attributes(visibility: 'hidden')
get :index, owner_with_name: @project.name_with_owner
get :index, name_with_owner: @project.name_with_owner
response.should redirect_to(new_user_session_path)
end
end

View File

@ -53,8 +53,8 @@ describe Projects::SubscribesController do
@project = FactoryGirl.create(:project)
@issue = FactoryGirl.create(:issue, project_id: @project.id)
@create_params = { issue_id: @issue.serial_id, owner_with_name: @project.name_with_owner }
@destroy_params = { issue_id: @issue.serial_id, owner_with_name: @project.name_with_owner }
@create_params = { issue_id: @issue.serial_id, name_with_owner: @project.name_with_owner }
@destroy_params = { issue_id: @issue.serial_id, name_with_owner: @project.name_with_owner }
any_instance_of(Project, versions: ['v1.0', 'v2.0'])

View File

@ -13,7 +13,7 @@ describe Projects::ProjectsController do
end
it "routes to #edit" do
get("/import/glib2.0-mib/modify").should route_to("projects/projects#edit", owner_with_name: 'import/glib2.0-mib')
get("/import/glib2.0-mib/modify").should route_to("projects/projects#edit", name_with_owner: 'import/glib2.0-mib')
end
it "routes to #create" do
@ -21,11 +21,11 @@ describe Projects::ProjectsController do
end
it "routes to #update" do
put("/import/glib2.0-mib").should route_to("projects/projects#update", owner_with_name: 'import/glib2.0-mib')
put("/import/glib2.0-mib").should route_to("projects/projects#update", name_with_owner: 'import/glib2.0-mib')
end
it "routes to #destroy" do
delete("/import/glib2.0-mib").should route_to("projects/projects#destroy", owner_with_name: 'import/glib2.0-mib')
delete("/import/glib2.0-mib").should route_to("projects/projects#destroy", name_with_owner: 'import/glib2.0-mib')
end
end
@ -35,13 +35,13 @@ describe Projects::Git::TreesController do
describe "routing" do
context "routes to #show" do
it { get("/import/glib2.0-mib").should route_to("projects/git/trees#show", owner_with_name: 'import/glib2.0-mib') }
it { get("/import/glib2.0-mib/tree/lib2safe-0.03").should route_to("projects/git/trees#show", owner_with_name: 'import/glib2.0-mib', treeish: 'lib2safe-0.03') }
it { get("/import/glib2.0-mib/tree/branch-with.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", owner_with_name: 'import/glib2.0-mib', treeish: 'branch-with.dot', path: 'folder_with.dot/path-with.dot') }
# it { get("/import/glib2.0-mib/tree/ветка-с.точкой/папка_с.точкой/путь-с.точкой").should route_to("projects/git/trees#show", owner_with_name: 'import/glib2.0-mib', treeish: 'ветка-с.точкой', path: 'папка_с.точкой/путь-с.точкой') }
it { get("/import/glib2.0-mib").should route_to("projects/git/trees#show", name_with_owner: 'import/glib2.0-mib') }
it { get("/import/glib2.0-mib/tree/lib2safe-0.03").should route_to("projects/git/trees#show", name_with_owner: 'import/glib2.0-mib', treeish: 'lib2safe-0.03') }
it { get("/import/glib2.0-mib/tree/branch-with.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", name_with_owner: 'import/glib2.0-mib', treeish: 'branch-with.dot', path: 'folder_with.dot/path-with.dot') }
# it { get("/import/glib2.0-mib/tree/ветка-с.точкой/папка_с.точкой/путь-с.точкой").should route_to("projects/git/trees#show", name_with_owner: 'import/glib2.0-mib', treeish: 'ветка-с.точкой', path: 'папка_с.точкой/путь-с.точкой') }
# TODO: ???
# it { get("/import/glib2.0-mib/tree/branch-with/slash.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", owner_with_name: 'import/glib2.0-mib', treeish: 'branch-with/slash.dot', path: 'folder_with.dot/path-with.dot') }
it { get("/import/glib2.0-mib/tree/tag13.52-5").should route_to("projects/git/trees#show", owner_with_name: 'import/glib2.0-mib', treeish: 'tag13.52-5') }
# it { get("/import/glib2.0-mib/tree/branch-with/slash.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", name_with_owner: 'import/glib2.0-mib', treeish: 'branch-with/slash.dot', path: 'folder_with.dot/path-with.dot') }
it { get("/import/glib2.0-mib/tree/tag13.52-5").should route_to("projects/git/trees#show", name_with_owner: 'import/glib2.0-mib', treeish: 'tag13.52-5') }
end
# TODO write more specs also with slash in branch name!