From: martyntaylor <[email protected]>

---
 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
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to