From bce70a380181df717c46d4f7076e64a993d797c0 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Thu, 26 Feb 2015 13:07:55 -0300 Subject: [PATCH] Project acceptance tests are passing --- app/models/project.rb | 3 ++- features/project/deletion.feature | 2 +- features/project/edition.feature | 12 ++++++------ features/project/listing.feature | 2 +- features/project/show.feature | 8 ++++---- features/step_definitions/project_steps.rb | 8 ++++---- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index a63f2f5..0b7a19a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -5,6 +5,7 @@ class Project < KalibroClient::Entities::Processor::Project end def attributes - ProjectAttributes.find_by_project_id(self.id) + project_attributes = ProjectAttributes.find_by_project_id(self.id) + project_attributes.nil? ? ProjectAttributes.new : project_attributes end end diff --git a/features/project/deletion.feature b/features/project/deletion.feature index 87f3bd4..1fb7c4f 100644 --- a/features/project/deletion.feature +++ b/features/project/deletion.feature @@ -22,7 +22,7 @@ Feature: Project Deletion Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the Sample Project page When I click the Destroy Project link Then I should be in the All Projects page diff --git a/features/project/edition.feature b/features/project/edition.feature index ba2540b..525229a 100644 --- a/features/project/edition.feature +++ b/features/project/edition.feature @@ -8,7 +8,7 @@ Feature: Project Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the All Projects page When I click the Edit link Then I should be in the Edit Project page @@ -35,7 +35,7 @@ Feature: Project Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the All Projects page When I click the Edit link Then The field "project[name]" should be filled with the sample project "name" @@ -46,7 +46,7 @@ Feature: Project Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the sample project edit page And I fill the Name field with "Kalibro" And I fill the Description field with "Web Service to collect metrics" @@ -61,7 +61,7 @@ Feature: Project And I have a project named "Qt-Calculator" And I own a project named "Kalibro" And I am at the sample project edit page - And I have a sample project_image + And I have sample project_attributes And I fill the Name field with "Qt-Calculator" When I press the Save button Then I should see "Name has already been taken" @@ -71,7 +71,7 @@ Feature: Project Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the sample project edit page And I fill the Description field with "Web Service to collect metrics" When I press the Save button @@ -82,7 +82,7 @@ Feature: Project Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the sample project edit page And I fill the Name field with " " When I press the Save button diff --git a/features/project/listing.feature b/features/project/listing.feature index 3ba6204..a69bbd3 100644 --- a/features/project/listing.feature +++ b/features/project/listing.feature @@ -25,7 +25,7 @@ Feature: Project listing Given I am a regular user And I am signed in And I have a sample project - And I have a sample project_image + And I have sample project_attributes And I am at the All Projects page When I click the Show link Then the sample project should be there \ No newline at end of file diff --git a/features/project/show.feature b/features/project/show.feature index e060c4f..adb6696 100644 --- a/features/project/show.feature +++ b/features/project/show.feature @@ -7,7 +7,7 @@ Feature: Show Project Scenario: Should not show the create repository link to user that doesn't own the project Given I am a regular user And I have a sample project - And I have a sample project_image + And I have sample project_attributes And I have a sample configuration with native metrics And I have a sample repository within the sample project When I am at the Sample Project page @@ -20,7 +20,7 @@ Scenario: Should show the create repository link the project owner Given I am a regular user And I am signed in And I own a sample project - And I have a sample project_image + And I have sample project_attributes When I am at the Sample Project page Then I should see "New Repository" @@ -28,7 +28,7 @@ Scenario: Should show the create repository link the project owner @kalibro_processor_restart Scenario: Considering the project has no repositories Given I have a sample project - And I have a sample project_image + And I have sample project_attributes When I am at the Sample Project page Then I should see "There are no Repositories yet!" @@ -43,6 +43,6 @@ Scenario: Considering the project has repositories @kalibro_processor_restart Scenario: Checking project contents Given I have a sample project - And I have a sample project_image + And I have sample project_attributes When I am at the Sample Project page Then the sample project should be there diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 03ce2ec..65b17c3 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -8,8 +8,8 @@ Given(/^I have a sample project$/) do @project = FactoryGirl.create(:project) end -Given(/^I have a sample project_image$/) do - @project_image = FactoryGirl.create(:project_image, {id: nil}) +Given(/^I have sample project_attributes$/) do + @project_attributes = FactoryGirl.create(:project_attributes, {id: nil}) end Given(/^I have a project named "(.*?)"$/) do |name| @@ -18,12 +18,12 @@ end Given(/^I own a sample project$/) do @project = FactoryGirl.create(:project) - FactoryGirl.create(:project_ownership, {user_id: @user.id, project_id: @project.id}) + FactoryGirl.create(:project_attributes, {user_id: @user.id, project_id: @project.id}) end Given(/^I own a project named "(.*?)"$/) do |name| @project = FactoryGirl.create(:project, {name: name}) - FactoryGirl.create(:project_ownership, {user_id: @user.id, project_id: @project.id}) + FactoryGirl.create(:project_attributes, {user_id: @user.id, project_id: @project.id}) end Given(/^I am at the Sample Project page$/) do -- libgit2 0.21.2