On 10/25/2010 02:18 PM, [email protected] wrote:
> From: Ladislav Martincik<[email protected]>
>
> ---
>   src/app/controllers/users_controller.rb         |    2 +-
>   src/features/authentication.feature             |   29 
> ++++++++++++++++------
>   src/features/step_definitions/authentication.rb |    5 +++-
>   3 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/src/app/controllers/users_controller.rb 
> b/src/app/controllers/users_controller.rb
> index ebe0e8a..9a6c1db 100644
> --- a/src/app/controllers/users_controller.rb
> +++ b/src/app/controllers/users_controller.rb
> @@ -21,7 +21,7 @@
>
>   class UsersController<  ApplicationController
>     before_filter :require_user, :only =>  [:show, :edit, :update, :index, 
> :destroy]
> -  before_filter :current_user, :only =>  [:new, :index, :destroy]
> +  before_filter :current_user
>
>     def new
>       @user = User.new
> diff --git a/src/features/authentication.feature 
> b/src/features/authentication.feature
> index 03ee914..b307c8f 100644
> --- a/src/features/authentication.feature
> +++ b/src/features/authentication.feature
> @@ -16,15 +16,29 @@ Feature: User authentication
>         | First name        | Joe                  |
>         | Last name         | Tester               |
>         | E-mail            | [email protected] |
> -    And I press "Create Account"
> -    Then I should be on testuser's user page
> -    And I should see "User registered!"
> +    And I press "Save"
> +    Then I should be on the dashboard page
> +
> +  Scenario: Want to register new user but decide to cancel
> +    Given I am on the homepage
> +    When I follow "Create one now"
> +    Then I should be on the new account page
> +    And I should see "New Account"
> +    When I fill in the following:
> +      | Choose a username | canceleduser         |
> +      | Choose a password | secret               |
> +      | Confirm password  | secret               |
> +      | First name        | Joe                  |
> +      | Last name         | Tester               |
> +      | E-mail            | [email protected] |
> +    And I follow "Cancel"
> +    Then I should be on the login page
> +    And there should not be user with login "canceluser"
>
>     Scenario: Log in as registered user
>       Given I am a registered user
>       And I am on the login page
>       When I login
> -    Then I should see "Login successful!"
>       And I should be on the home page
>
>     Scenario: Log in without password
> @@ -38,11 +52,10 @@ Feature: User authentication
>       Given I am logged in
>       And I am on the homepage
>       When I want to edit my profile
> -    And I follow "Edit"
> -    Then I should see "Edit an Account"
> +    Then should see "Editing Account"
>       When I fill in "E-mail" with "[email protected]"
> -    And I press "Make Changes"
> -    Then I should be on the account page
> +    And I press "Save"
> +    Then I should be on the dashboard page
>       And I should see "User updated!"
>
>     Scenario: log out
> diff --git a/src/features/step_definitions/authentication.rb 
> b/src/features/step_definitions/authentication.rb
> index 0c72146..bebf3f8 100644
> --- a/src/features/step_definitions/authentication.rb
> +++ b/src/features/step_definitions/authentication.rb
> @@ -33,7 +33,6 @@ end
>
>   When /^I want to edit my profile$/ do
>     click_link "#{user.first_name} #{user.last_name}"
> -  response.should contain("User Profile for #{user.login}")
>   end
>
>   Then /^I should be logged out$/ do
> @@ -44,3 +43,7 @@ Then /^I should have one private pool named "([^\"]*)"$/ do 
> |login|
>     Pool.find_by_name(login).should_not be_nil
>     Pool.find_by_name(login).permissions.size.should == 1
>   end
> +
> +Then /^there should not be user with login "([^\"]*)"$/ do |login|
> +  User.find_by_login(login).should be_nil
> +end

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

Reply via email to