Fixing requests after namespaces. Fixed admin bug with access to project

This commit is contained in:
Dmitriy Zaporozhets 2012-11-23 22:25:28 +02:00
parent e92b563acf
commit 0e1635a68a
14 changed files with 35 additions and 62 deletions

View file

@ -2,9 +2,7 @@ require 'spec_helper'
describe "Admin::Hooks" do
before do
@project = create(:project,
name: "LeGiT",
code: "LGT")
@project = create(:project)
login_as :admin
@system_hook = create(:system_hook)

View file

@ -39,8 +39,8 @@ describe "Admin::Projects" do
end
it "should have project edit page" do
page.should have_content("Project name")
page.should have_content("URL")
page.should have_content("Edit project")
page.should have_button("Save Project")
end
describe "Update project" do
@ -60,39 +60,6 @@ describe "Admin::Projects" do
end
end
describe "GET /admin/projects/new" do
before do
visit admin_projects_path
click_link "New Project"
end
it "should be correct path" do
current_path.should == new_admin_project_path
end
it "should have labels for new project" do
page.should have_content("Project name is")
end
end
describe "POST /admin/projects" do
before do
visit new_admin_project_path
fill_in 'project_name', 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 == admin_project_path(@project)
end
it "should show project" do
page.should have_content(@project.name)
page.should have_content(@project.path)
end
end
describe "Add new team member" do
before do
@new_user = create(:user)

View file

@ -23,6 +23,7 @@ describe "Admin::Users" do
@password = "123ABC"
visit new_admin_user_path
fill_in "user_name", with: "Big Bang"
fill_in "user_username", with: "bang"
fill_in "user_email", with: "bigbang@mail.com"
fill_in "user_password", with: @password
fill_in "user_password_confirmation", with: @password

View file

@ -11,7 +11,7 @@ describe Gitlab::API do
describe "GET /projects/:id/milestones" do
it "should return project milestones" do
get api("/projects/#{project.code}/milestones", user)
get api("/projects/#{project.path}/milestones", user)
response.status.should == 200
json_response.should be_an Array
json_response.first['title'].should == milestone.title
@ -20,7 +20,7 @@ describe Gitlab::API do
describe "GET /projects/:id/milestones/:milestone_id" do
it "should return a project milestone by id" do
get api("/projects/#{project.code}/milestones/#{milestone.id}", user)
get api("/projects/#{project.path}/milestones/#{milestone.id}", user)
response.status.should == 200
json_response['title'].should == milestone.title
end
@ -28,7 +28,7 @@ describe Gitlab::API do
describe "POST /projects/:id/milestones" do
it "should create a new project milestone" do
post api("/projects/#{project.code}/milestones", user),
post api("/projects/#{project.path}/milestones", user),
title: 'new milestone'
response.status.should == 201
json_response['title'].should == 'new milestone'
@ -38,7 +38,7 @@ describe Gitlab::API do
describe "PUT /projects/:id/milestones/:milestone_id" do
it "should update a project milestone" do
put api("/projects/#{project.code}/milestones/#{milestone.id}", user),
put api("/projects/#{project.path}/milestones/#{milestone.id}", user),
title: 'updated title'
response.status.should == 200
json_response['title'].should == 'updated title'

View file

@ -53,7 +53,6 @@ describe Gitlab::API do
it "should assign attributes to project" do
project = attributes_for(:project, {
path: project.name.parameterize,
description: Faker::Lorem.sentence,
default_branch: 'stable',
issues_enabled: false,
@ -257,7 +256,7 @@ describe Gitlab::API do
describe "POST /projects/:id/snippets" do
it "should create a new project snippet" do
post api("/projects/#{project.path}/snippets", user),
title: 'api test', file_name: 'sample.rb', path: 'test'
title: 'api test', file_name: 'sample.rb', code: 'test'
response.status.should == 201
json_response['title'].should == 'api test'
end
@ -266,10 +265,10 @@ describe Gitlab::API do
describe "PUT /projects/:id/snippets/:shippet_id" do
it "should update an existing project snippet" do
put api("/projects/#{project.path}/snippets/#{snippet.id}", user),
path: 'updated path'
code: 'updated code'
response.status.should == 200
json_response['title'].should == 'example'
snippet.reload.content.should == 'updated path'
snippet.reload.content.should == 'updated code'
end
end