From: Jan Provaznik <[email protected]>

User id is now passed when editing user after creation.
---
 src/app/views/users/show.haml               |    2 +-
 src/features/step_definitions/user_steps.rb |    7 +++++
 src/features/support/paths.rb               |    3 ++
 src/features/user.feature                   |   33 +++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 1 deletions(-)
 create mode 100644 src/features/step_definitions/user_steps.rb
 create mode 100644 src/features/user.feature

diff --git a/src/app/views/users/show.haml b/src/app/views/users/show.haml
index fd7254f..34aff16 100644
--- a/src/app/views/users/show.haml
+++ b/src/app/views/users/show.haml
@@ -26,4 +26,4 @@
       %label Current Login IP:
     %li.block.grid_5.omega
       = h @user.current_login_ip
-  = link_to 'Edit', edit_account_path, :class => 'actionlink button'
+  = link_to 'Edit', {:action => 'edit', :id => @user}, :class => 'actionlink 
button'
diff --git a/src/features/step_definitions/user_steps.rb 
b/src/features/step_definitions/user_steps.rb
new file mode 100644
index 0000000..0c7fbc7
--- /dev/null
+++ b/src/features/step_definitions/user_steps.rb
@@ -0,0 +1,7 @@
+Given /^there is not a user named "([^"]*)"$/ do |name|
+  User.find_by_login(name).should be_nil
+end
+
+Then /^I should have a user named "([^"]*)"$/ do |name|
+  User.find_by_login(name).should_not be_nil
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index b0a5f7e..ccfd1af 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -74,6 +74,9 @@ module NavigationHelpers
     when /the create template page/
       url_for :action => 'create', :controller => 'templates', :only_path => 
true
 
+    when /the show user page/
+      user_path
+
     # Add more mappings here.
     # Here is an example that pulls values out of the Regexp:
     #
diff --git a/src/features/user.feature b/src/features/user.feature
new file mode 100644
index 0000000..3915149
--- /dev/null
+++ b/src/features/user.feature
@@ -0,0 +1,33 @@
+Feature: Manage Users
+  In order to manage my cloud infrastructure
+  As a user
+  I want to manage users
+
+  Background:
+    Given I am an authorised user
+    And I am logged in
+
+  Scenario: Create and edit a new User
+    Given I am on the users page
+    And there is not a user named "testuser"
+    When I follow "create"
+    Then I should be on the new user page
+    And I should see "New Account"
+    When I fill in the following:
+      | user_login                  | testuser              |
+      | user_password               | pass                  |
+      | user_password_confirmation  | pass                  |
+      | user_first_name             | test                  |
+      | user_last_name              | user                  |
+      | user_email                  | [email protected]  |
+    And I press "Create Account"
+    Then I should be on the show user page
+    And I should see "User registered"
+    And I should have a user named "testuser"
+    When I follow "Edit"
+    Then I should see "Editing User"
+    And the "Choose a username" field should contain "testuser"
+    When I fill in "user_login" with "testuser2"
+    And I press "Save"
+    Then I should be on the account page
+    And I should see "User updated"
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to