Commit bce70a380181df717c46d4f7076e64a993d797c0

Authored by Rafael Manzo
1 parent 4be59d5e

Project acceptance tests are passing

app/models/project.rb
@@ -5,6 +5,7 @@ class Project < KalibroClient::Entities::Processor::Project @@ -5,6 +5,7 @@ class Project < KalibroClient::Entities::Processor::Project
5 end 5 end
6 6
7 def attributes 7 def attributes
8 - ProjectAttributes.find_by_project_id(self.id) 8 + project_attributes = ProjectAttributes.find_by_project_id(self.id)
  9 + project_attributes.nil? ? ProjectAttributes.new : project_attributes
9 end 10 end
10 end 11 end
features/project/deletion.feature
@@ -22,7 +22,7 @@ Feature: Project Deletion @@ -22,7 +22,7 @@ Feature: Project Deletion
22 Given I am a regular user 22 Given I am a regular user
23 And I am signed in 23 And I am signed in
24 And I own a sample project 24 And I own a sample project
25 - And I have a sample project_image 25 + And I have sample project_attributes
26 And I am at the Sample Project page 26 And I am at the Sample Project page
27 When I click the Destroy Project link 27 When I click the Destroy Project link
28 Then I should be in the All Projects page 28 Then I should be in the All Projects page
features/project/edition.feature
@@ -8,7 +8,7 @@ Feature: Project @@ -8,7 +8,7 @@ Feature: Project
8 Given I am a regular user 8 Given I am a regular user
9 And I am signed in 9 And I am signed in
10 And I own a sample project 10 And I own a sample project
11 - And I have a sample project_image 11 + And I have sample project_attributes
12 And I am at the All Projects page 12 And I am at the All Projects page
13 When I click the Edit link 13 When I click the Edit link
14 Then I should be in the Edit Project page 14 Then I should be in the Edit Project page
@@ -35,7 +35,7 @@ Feature: Project @@ -35,7 +35,7 @@ Feature: Project
35 Given I am a regular user 35 Given I am a regular user
36 And I am signed in 36 And I am signed in
37 And I own a sample project 37 And I own a sample project
38 - And I have a sample project_image 38 + And I have sample project_attributes
39 And I am at the All Projects page 39 And I am at the All Projects page
40 When I click the Edit link 40 When I click the Edit link
41 Then The field "project[name]" should be filled with the sample project "name" 41 Then The field "project[name]" should be filled with the sample project "name"
@@ -46,7 +46,7 @@ Feature: Project @@ -46,7 +46,7 @@ Feature: Project
46 Given I am a regular user 46 Given I am a regular user
47 And I am signed in 47 And I am signed in
48 And I own a sample project 48 And I own a sample project
49 - And I have a sample project_image 49 + And I have sample project_attributes
50 And I am at the sample project edit page 50 And I am at the sample project edit page
51 And I fill the Name field with "Kalibro" 51 And I fill the Name field with "Kalibro"
52 And I fill the Description field with "Web Service to collect metrics" 52 And I fill the Description field with "Web Service to collect metrics"
@@ -61,7 +61,7 @@ Feature: Project @@ -61,7 +61,7 @@ Feature: Project
61 And I have a project named "Qt-Calculator" 61 And I have a project named "Qt-Calculator"
62 And I own a project named "Kalibro" 62 And I own a project named "Kalibro"
63 And I am at the sample project edit page 63 And I am at the sample project edit page
64 - And I have a sample project_image 64 + And I have sample project_attributes
65 And I fill the Name field with "Qt-Calculator" 65 And I fill the Name field with "Qt-Calculator"
66 When I press the Save button 66 When I press the Save button
67 Then I should see "Name has already been taken" 67 Then I should see "Name has already been taken"
@@ -71,7 +71,7 @@ Feature: Project @@ -71,7 +71,7 @@ Feature: Project
71 Given I am a regular user 71 Given I am a regular user
72 And I am signed in 72 And I am signed in
73 And I own a sample project 73 And I own a sample project
74 - And I have a sample project_image 74 + And I have sample project_attributes
75 And I am at the sample project edit page 75 And I am at the sample project edit page
76 And I fill the Description field with "Web Service to collect metrics" 76 And I fill the Description field with "Web Service to collect metrics"
77 When I press the Save button 77 When I press the Save button
@@ -82,7 +82,7 @@ Feature: Project @@ -82,7 +82,7 @@ Feature: Project
82 Given I am a regular user 82 Given I am a regular user
83 And I am signed in 83 And I am signed in
84 And I own a sample project 84 And I own a sample project
85 - And I have a sample project_image 85 + And I have sample project_attributes
86 And I am at the sample project edit page 86 And I am at the sample project edit page
87 And I fill the Name field with " " 87 And I fill the Name field with " "
88 When I press the Save button 88 When I press the Save button
features/project/listing.feature
@@ -25,7 +25,7 @@ Feature: Project listing @@ -25,7 +25,7 @@ Feature: Project listing
25 Given I am a regular user 25 Given I am a regular user
26 And I am signed in 26 And I am signed in
27 And I have a sample project 27 And I have a sample project
28 - And I have a sample project_image 28 + And I have sample project_attributes
29 And I am at the All Projects page 29 And I am at the All Projects page
30 When I click the Show link 30 When I click the Show link
31 Then the sample project should be there 31 Then the sample project should be there
32 \ No newline at end of file 32 \ No newline at end of file
features/project/show.feature
@@ -7,7 +7,7 @@ Feature: Show Project @@ -7,7 +7,7 @@ Feature: Show Project
7 Scenario: Should not show the create repository link to user that doesn't own the project 7 Scenario: Should not show the create repository link to user that doesn't own the project
8 Given I am a regular user 8 Given I am a regular user
9 And I have a sample project 9 And I have a sample project
10 - And I have a sample project_image 10 + And I have sample project_attributes
11 And I have a sample configuration with native metrics 11 And I have a sample configuration with native metrics
12 And I have a sample repository within the sample project 12 And I have a sample repository within the sample project
13 When I am at the Sample Project page 13 When I am at the Sample Project page
@@ -20,7 +20,7 @@ Scenario: Should show the create repository link the project owner @@ -20,7 +20,7 @@ Scenario: Should show the create repository link the project owner
20 Given I am a regular user 20 Given I am a regular user
21 And I am signed in 21 And I am signed in
22 And I own a sample project 22 And I own a sample project
23 - And I have a sample project_image 23 + And I have sample project_attributes
24 When I am at the Sample Project page 24 When I am at the Sample Project page
25 Then I should see "New Repository" 25 Then I should see "New Repository"
26 26
@@ -28,7 +28,7 @@ Scenario: Should show the create repository link the project owner @@ -28,7 +28,7 @@ Scenario: Should show the create repository link the project owner
28 @kalibro_processor_restart 28 @kalibro_processor_restart
29 Scenario: Considering the project has no repositories 29 Scenario: Considering the project has no repositories
30 Given I have a sample project 30 Given I have a sample project
31 - And I have a sample project_image 31 + And I have sample project_attributes
32 When I am at the Sample Project page 32 When I am at the Sample Project page
33 Then I should see "There are no Repositories yet!" 33 Then I should see "There are no Repositories yet!"
34 34
@@ -43,6 +43,6 @@ Scenario: Considering the project has repositories @@ -43,6 +43,6 @@ Scenario: Considering the project has repositories
43 @kalibro_processor_restart 43 @kalibro_processor_restart
44 Scenario: Checking project contents 44 Scenario: Checking project contents
45 Given I have a sample project 45 Given I have a sample project
46 - And I have a sample project_image 46 + And I have sample project_attributes
47 When I am at the Sample Project page 47 When I am at the Sample Project page
48 Then the sample project should be there 48 Then the sample project should be there
features/step_definitions/project_steps.rb
@@ -8,8 +8,8 @@ Given(/^I have a sample project$/) do @@ -8,8 +8,8 @@ Given(/^I have a sample project$/) do
8 @project = FactoryGirl.create(:project) 8 @project = FactoryGirl.create(:project)
9 end 9 end
10 10
11 -Given(/^I have a sample project_image$/) do  
12 - @project_image = FactoryGirl.create(:project_image, {id: nil}) 11 +Given(/^I have sample project_attributes$/) do
  12 + @project_attributes = FactoryGirl.create(:project_attributes, {id: nil})
13 end 13 end
14 14
15 Given(/^I have a project named "(.*?)"$/) do |name| 15 Given(/^I have a project named "(.*?)"$/) do |name|
@@ -18,12 +18,12 @@ end @@ -18,12 +18,12 @@ end
18 18
19 Given(/^I own a sample project$/) do 19 Given(/^I own a sample project$/) do
20 @project = FactoryGirl.create(:project) 20 @project = FactoryGirl.create(:project)
21 - FactoryGirl.create(:project_ownership, {user_id: @user.id, project_id: @project.id}) 21 + FactoryGirl.create(:project_attributes, {user_id: @user.id, project_id: @project.id})
22 end 22 end
23 23
24 Given(/^I own a project named "(.*?)"$/) do |name| 24 Given(/^I own a project named "(.*?)"$/) do |name|
25 @project = FactoryGirl.create(:project, {name: name}) 25 @project = FactoryGirl.create(:project, {name: name})
26 - FactoryGirl.create(:project_ownership, {user_id: @user.id, project_id: @project.id}) 26 + FactoryGirl.create(:project_attributes, {user_id: @user.id, project_id: @project.id})
27 end 27 end
28 28
29 Given(/^I am at the Sample Project page$/) do 29 Given(/^I am at the Sample Project page$/) do