ACK
----- Original Message -----
From: mtaylor(a)redhat.com
To: deltacloud-devel(a)lists.fedorahosted.org
Sent: Monday, November 1, 2010 4:53:59 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome /
Stockholm / Vienna
Subject: [deltacloud-devel] [PATCH aggregator] BZ#643921 Test for maximum length of user
login on edit user page
From: martyntaylor <mtaylor(a)redhat.com>
---
src/features/authentication.feature | 9 +++++++++
src/features/step_definitions/authentication.rb | 7 +++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/features/authentication.feature b/src/features/authentication.feature
index b307c8f..8b94a55 100644
--- a/src/features/authentication.feature
+++ b/src/features/authentication.feature
@@ -66,3 +66,12 @@ Feature: User authentication
And I should see "Logout successful!"
And I should see "Create one now."
And I should see "Log In"
+
+ Scenario: Change user login to one with invalid length
+ Given I am logged in
+ And I am on the homepage
+ When I want to edit my profile
+ Then should see "Editing Account"
+ When I enter a string of length "101" into "user[login]"
+ And I press "Save"
+ Then I should see "Login is too long (maximum is 100 characters)"
\ No newline at end of file
diff --git a/src/features/step_definitions/authentication.rb
b/src/features/step_definitions/authentication.rb
index bebf3f8..13bc9a6 100644
--- a/src/features/step_definitions/authentication.rb
+++ b/src/features/step_definitions/authentication.rb
@@ -47,3 +47,10 @@ end
Then /^there should not be user with login "([^\"]*)"$/ do |login|
User.find_by_login(login).should be_nil
end
+
+When /^I enter a string of length "([^"]*)" into
"([^"]*)"$/ do |length, field_name|
+ valid_chars = [*('a'..'z')] + [*('A'..'Z')] + [*(1..9)]
+ ['_', '-']
+ string = ""
+ length.to_i.times { string << valid_chars[rand(valid_chars.length)] }
+ When "I fill in \"#{field_name}\" with \"#{string}\""
+end
\ No newline at end of file
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
deltacloud-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/deltacloud-devel