From 4d2da5fd2585fead823c4450e54613dadf882c0d Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 22 Jan 2016 17:55:12 +0100 Subject: WIP - spec failure on .atom project URL --- spec/controllers/projects_controller_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/controllers/projects_controller_spec.rb') diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 665526fde93..ad143c14c43 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -86,6 +86,17 @@ describe ProjectsController do end end end + + context "when the url contains .atom" do + let(:public_project_with_dot) { create(:project, :public, name: 'my.atom', path: 'my.atom') } + + it 'loads a project' do + get :show, namespace_id: public_project_with_dot.namespace.path, id: public_project_with_dot.path + + expect(assigns(:project)).to eq(public_project_with_dot) + expect(response.status).to eq(200) + end + end end describe "#destroy" do -- cgit v1.2.1 From eb51a4ac1b7702873ecb9de7ddafdb989370437c Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 29 Jan 2016 15:35:21 +0100 Subject: refactor previous test and add validation to project model --- spec/controllers/projects_controller_spec.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'spec/controllers/projects_controller_spec.rb') diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index ad143c14c43..245cf96d644 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -88,13 +88,10 @@ describe ProjectsController do end 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 - get :show, namespace_id: public_project_with_dot.namespace.path, id: public_project_with_dot.path - - expect(assigns(:project)).to eq(public_project_with_dot) - expect(response.status).to eq(200) + it 'expect an error creating the project' do + expect { public_project_with_dot_atom }.to raise_error(ActiveRecord::RecordInvalid) end end end -- cgit v1.2.1 From 7b868c61ab371fc9319e6dd1baa2c089bc275618 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 4 Feb 2016 13:20:55 +0100 Subject: refactored migration and spec based on feedback --- spec/controllers/projects_controller_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/controllers/projects_controller_spec.rb') diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 245cf96d644..6eee4dfe229 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -88,10 +88,10 @@ describe ProjectsController do end context "when the url contains .atom" do - let(:public_project_with_dot_atom) { create(:project, :public, name: 'my.atom', path: 'my.atom') } + let(:public_project_with_dot_atom) { build(:project, :public, name: 'my.atom', path: 'my.atom') } it 'expect an error creating the project' do - expect { public_project_with_dot_atom }.to raise_error(ActiveRecord::RecordInvalid) + expect(public_project_with_dot_atom).not_to be_valid end end end -- cgit v1.2.1