Skip to content
Snippets Groups Projects
Commit eb51a4ac authored by James Lopez's avatar James Lopez
Browse files

refactor previous test and add validation to project model

parent 7ca67796
No related branches found
No related tags found
No related merge requests found
Loading
@@ -34,12 +34,12 @@ module Gitlab
Loading
@@ -34,12 +34,12 @@ module Gitlab
   
   
def project_path_regex def project_path_regex
@project_path_regex ||= /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)\z/.freeze @project_path_regex ||= /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git|\.atom)\z/.freeze
end end
   
def project_path_regex_message def project_path_regex_message
"can contain only letters, digits, '_', '-' and '.'. " \ "can contain only letters, digits, '_', '-' and '.'. " \
"Cannot start with '-' or end in '.git'" \ "Cannot start with '-', end in '.git' or end in '.atom'" \
end end
   
   
Loading
Loading
Loading
@@ -88,13 +88,10 @@ describe ProjectsController do
Loading
@@ -88,13 +88,10 @@ describe ProjectsController do
end end
   
context "when the url contains .atom" do context "when the url contains .atom" do
let(:public_project_with_dot) { create(:project, :public, name: 'my.atom', path: 'my.atom') } let(:public_project_with_dot_atom) { create(:project, :public, name: 'my.atom', path: 'my.atom') }
   
it 'loads a project' do it 'expect an error creating the project' do
get :show, namespace_id: public_project_with_dot.namespace.path, id: public_project_with_dot.path expect { public_project_with_dot_atom }.to raise_error(ActiveRecord::RecordInvalid)
expect(assigns(:project)).to eq(public_project_with_dot)
expect(response.status).to eq(200)
end end
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment