From 49f3853e32944db89fd073d0e3e5cac91e84071b Mon Sep 17 00:00:00 2001 From: Diego Araújo + Rafael Manzo Date: Mon, 2 Sep 2013 15:52:43 -0300 Subject: [PATCH] Validation for project edition acceptance tests. --- features/project/create.feature | 4 ++-- features/project/edition.feature | 44 ++++++++++++++++++++++++++++++++++++++------ features/step_definitions/project_steps.rb | 4 ++++ features/step_definitions/user_update_steps.rb | 2 +- features/user_update.feature | 4 ++-- 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/features/project/create.feature b/features/project/create.feature index 211db62..f8913e2 100644 --- a/features/project/create.feature +++ b/features/project/create.feature @@ -14,8 +14,8 @@ Feature: Project Creation Given I am a regular user And I am signed in And I am at the New Project page - And I fill the Name field with Kalibro - And I fill the Description field with Web Service to collect metrics + And I fill the Name field with "Kalibro" + And I fill the Description field with "Web Service to collect metrics" When I press the Create Project button Then I should see Kalibro And I should see Web Service to collect metrics \ No newline at end of file diff --git a/features/project/edition.feature b/features/project/edition.feature index 9648f18..edc09ae 100644 --- a/features/project/edition.feature +++ b/features/project/edition.feature @@ -4,7 +4,7 @@ Feature: Project I should be able to edit my projects @kalibro_restart - Scenario: Should go to edit form from All Projects page + Scenario: Going to the edit page Given I am a regular user And I am signed in And I have a sample project @@ -13,7 +13,7 @@ Feature: Project Then I should be in the Edit Project page @kalibro_restart - Scenario: Should have the content filled in form + Scenario: Filling up the form Given I am a regular user And I am signed in And I have a sample project @@ -23,13 +23,45 @@ Feature: Project And The field "project[description]" should be filled with the sample project "description" @kalibro_restart - Scenario: After project edition should update the information + Scenario: With valid attributes Given I am a regular user And I am signed in And I have a sample project 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 + And I fill the Name field with "Kalibro" + And I fill the Description field with "Web Service to collect metrics" When I press the Update button Then I should see Kalibro - And I should see Web Service to collect metrics \ No newline at end of file + And I should see Web Service to collect metrics + + @kalibro_restart + Scenario: With project name already taken + Given I am a regular user + And I am signed in + And I have a project named "Qt-Calculator" + And I have a project named "Kalibro" + And I am at the sample project edit page + And I fill the Name field with "Qt-Calculator" + When I press the Update button + Then I should see There's already + + @kalibro_restart @wip + Scenario: Editing just the description + Given I am a regular user + And I am signed in + And I have a sample project + 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 Update button + Then I should see Kalibro + And I should see Web Service to collect metrics + + @kalibro_restart + Scenario: With blank project name + Given I am a regular user + And I am signed in + And I have a sample project + And I am at the sample project edit page + And I fill the Name field with " " + When I press the Update button + Then I should see Name can't be blank diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 41d7dd5..91d7e5f 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -8,6 +8,10 @@ Given(/^I have a sample project$/) do @project = FactoryGirl.create(:project, {id: nil}) end +Given(/^I have a project named "(.*?)"$/) do |name| + @project = FactoryGirl.create(:project, {id: nil, name: name}) +end + Given(/^I am at the Sample Project page$/) do visit project_path(@project.id) end diff --git a/features/step_definitions/user_update_steps.rb b/features/step_definitions/user_update_steps.rb index d585311..608bcf5 100644 --- a/features/step_definitions/user_update_steps.rb +++ b/features/step_definitions/user_update_steps.rb @@ -6,7 +6,7 @@ When(/^I press the (.+) button$/) do |text| click_button text end -When(/^I fill the (.+) field with (.+)$/) do |field, text| +When(/^I fill the (.+) field with "(.+)"$/) do |field, text| fill_in field, :with => text end diff --git a/features/user_update.feature b/features/user_update.feature index 97c5626..642b283 100644 --- a/features/user_update.feature +++ b/features/user_update.feature @@ -8,8 +8,8 @@ Feature: User update And I am signed in And I am at the homepage When I click the Edit link - And I fill the Name field with Rafael Manzo - And I fill the Current password field with password + And I fill the Name field with "Rafael Manzo" + And I fill the Current password field with "password" And I press the Update button Then I should see You updated your account successfully And my name should have changed to Rafael Manzo \ No newline at end of file -- libgit2 0.21.2