Commit 49f3853e32944db89fd073d0e3e5cac91e84071b

Authored by Diego Camarinha
Committed by Rafael Manzo
1 parent 9d674677

Validation for project edition acceptance tests.

Refactored the "I fill in" step.
features/project/create.feature
... ... @@ -14,8 +14,8 @@ Feature: Project Creation
14 14 Given I am a regular user
15 15 And I am signed in
16 16 And I am at the New Project page
17   - And I fill the Name field with Kalibro
18   - And I fill the Description field with Web Service to collect metrics
  17 + And I fill the Name field with "Kalibro"
  18 + And I fill the Description field with "Web Service to collect metrics"
19 19 When I press the Create Project button
20 20 Then I should see Kalibro
21 21 And I should see Web Service to collect metrics
22 22 \ No newline at end of file
... ...
features/project/edition.feature
... ... @@ -4,7 +4,7 @@ Feature: Project
4 4 I should be able to edit my projects
5 5  
6 6 @kalibro_restart
7   - Scenario: Should go to edit form from All Projects page
  7 + Scenario: Going to the edit page
8 8 Given I am a regular user
9 9 And I am signed in
10 10 And I have a sample project
... ... @@ -13,7 +13,7 @@ Feature: Project
13 13 Then I should be in the Edit Project page
14 14  
15 15 @kalibro_restart
16   - Scenario: Should have the content filled in form
  16 + Scenario: Filling up the form
17 17 Given I am a regular user
18 18 And I am signed in
19 19 And I have a sample project
... ... @@ -23,13 +23,45 @@ Feature: Project
23 23 And The field "project[description]" should be filled with the sample project "description"
24 24  
25 25 @kalibro_restart
26   - Scenario: After project edition should update the information
  26 + Scenario: With valid attributes
27 27 Given I am a regular user
28 28 And I am signed in
29 29 And I have a sample project
30 30 And I am at the sample project edit page
31   - And I fill the Name field with Kalibro
32   - And I fill the Description field with Web Service to collect metrics
  31 + And I fill the Name field with "Kalibro"
  32 + And I fill the Description field with "Web Service to collect metrics"
33 33 When I press the Update button
34 34 Then I should see Kalibro
35   - And I should see Web Service to collect metrics
36 35 \ No newline at end of file
  36 + And I should see Web Service to collect metrics
  37 +
  38 + @kalibro_restart
  39 + Scenario: With project name already taken
  40 + Given I am a regular user
  41 + And I am signed in
  42 + And I have a project named "Qt-Calculator"
  43 + And I have a project named "Kalibro"
  44 + And I am at the sample project edit page
  45 + And I fill the Name field with "Qt-Calculator"
  46 + When I press the Update button
  47 + Then I should see There's already
  48 +
  49 + @kalibro_restart @wip
  50 + Scenario: Editing just the description
  51 + Given I am a regular user
  52 + And I am signed in
  53 + And I have a sample project
  54 + And I am at the sample project edit page
  55 + And I fill the Description field with "Web Service to collect metrics"
  56 + When I press the Update button
  57 + Then I should see Kalibro
  58 + And I should see Web Service to collect metrics
  59 +
  60 + @kalibro_restart
  61 + Scenario: With blank project name
  62 + Given I am a regular user
  63 + And I am signed in
  64 + And I have a sample project
  65 + And I am at the sample project edit page
  66 + And I fill the Name field with " "
  67 + When I press the Update button
  68 + Then I should see Name can't be blank
... ...
features/step_definitions/project_steps.rb
... ... @@ -8,6 +8,10 @@ Given(/^I have a sample project$/) do
8 8 @project = FactoryGirl.create(:project, {id: nil})
9 9 end
10 10  
  11 +Given(/^I have a project named "(.*?)"$/) do |name|
  12 + @project = FactoryGirl.create(:project, {id: nil, name: name})
  13 +end
  14 +
11 15 Given(/^I am at the Sample Project page$/) do
12 16 visit project_path(@project.id)
13 17 end
... ...
features/step_definitions/user_update_steps.rb
... ... @@ -6,7 +6,7 @@ When(/^I press the (.+) button$/) do |text|
6 6 click_button text
7 7 end
8 8  
9   -When(/^I fill the (.+) field with (.+)$/) do |field, text|
  9 +When(/^I fill the (.+) field with "(.+)"$/) do |field, text|
10 10 fill_in field, :with => text
11 11 end
12 12  
... ...
features/user_update.feature
... ... @@ -8,8 +8,8 @@ Feature: User update
8 8 And I am signed in
9 9 And I am at the homepage
10 10 When I click the Edit link
11   - And I fill the Name field with Rafael Manzo
12   - And I fill the Current password field with password
  11 + And I fill the Name field with "Rafael Manzo"
  12 + And I fill the Current password field with "password"
13 13 And I press the Update button
14 14 Then I should see You updated your account successfully
15 15 And my name should have changed to Rafael Manzo
16 16 \ No newline at end of file
... ...