Merge branch 'feature/unauthorized_admin_login'

This commit is contained in:
Mario Visic 2011-08-28 01:15:25 +08:00
commit ff901ca3d3
2 changed files with 17 additions and 5 deletions

View File

@ -9,10 +9,10 @@ module Admin
before_filter :require_site
load_and_authorize_resource
before_filter :validate_site_membership
load_and_authorize_resource
before_filter :set_locale
helper_method :sections, :current_site_url, :site_url, :page_url, :current_ability

View File

@ -6,16 +6,28 @@ Feature: Login
Background:
Given I have the site: "test site" set up
Scenario: Successful authentication
Scenario: Successfully logging in
When I go to login
And I fill in "Email" with "admin@locomotiveapp.org"
And I fill in "Password" with "easyone"
And I press "Log in"
Then I should see "Listing pages"
Scenario: Failed authentication
Scenario: Attempting to login with an invalid emai or password
When I go to login
And I fill in "Email" with "admin@locomotiveapp.org"
And I fill in "Password" with ""
And I press "Log in"
Then I should not see "Listing pages"
Then I should not see "Listing pages"
And I should see "Invalid email or password"
Scenario: Attempting to login with an account without a membership
Given the following accounts exist:
| email | password | password_confirmation |
| john@locomotiveapp.org | bluecheese | bluecheese |
When I go to login
And I fill in "Email" with "john@locomotiveapp.org"
And I fill in "Password" with "bluecheese"
And I press "Log in"
Then I should not see "Listing pages"
And I should see "not a member of this site"