Feature: Managing articles on the site
As an authenticated user of the site
I should be able to create, modify, and delete articles
So that I can add content to the site
Scenario: Attempting to visit 'admin' area without logging in
When I go to article admin page
Then I should see the login form
Scenario: Log out of the 'admin' area
Given I have signed in as user "jenny" with a password of "password"
When I go to article admin page
And I follow "logout"
When I go to article admin page
Then I should see the login form
Scenario: Navigating to page for creating a 'new article'
Given I have signed in as user "jenny" with a password of "password"
When I go to article admin page
And I follow "new_post"
Then I should see the form for creating new articles
Scenario: Creating a new article
Given I have signed in as user "jenny" with a password of "password"
When I go to article admin page
And I follow "new_post"
And I fill in "article[title]" with "My first article"
And I fill in "article[body]" with "This is my first article ever"
And I press "Create"
Then I should see "My first article"
And the 1st row of the list of articles should contain a TD element with a CSS class of "me"
Scenario: Editing an existing article
Given I have signed in as user "jenny" with a password of "password"
And "tom" has created an article with the title "My First Article" and a body of "The original body"
When I go to article admin page
And I follow the "edit" link for the article titled "My First Article"
And I fill in "article[title]" with "I have updated the title"
And I press "Update"
Then I should see "I have updated the title"
Scenario: Deleting an existing article
Given I have signed in as user "jenny" with a password of "password"
And "jenny" has created an article with the title "My First Article" and a body of "The original body"
When I go to article admin page
And I follow the "edit" link for the article titled "My First Article"
And I follow the "delete" link for the article titled "My First Article"
Then I should not see "My First Article"
Scenario: Reviewing which user created an article
Given I have created 3 articles as user "tom" with a password of "psswrd"
And I have created 1 articles as user "jenny" with a password of "password"
And I have signed in as user "jenny" with a password of "password"
When I go to article admin page
Then the 1st row of the list of articles should contain a TD element with a CSS class of "me"
And the 2nd row of the list of articles should contain a TD element with a CSS class of "other_author"
And the 3rd row of the list of articles should contain a TD element with a CSS class of "other_author"
And the 4th row of the list of articles should contain a TD element with a CSS class of "other_author"
Scenario: Attempting to create a new article without a title
Given I have signed in as user "jenny" with a password of "password"
When I go to article admin page
When I follow "new_post"
And I fill in "article[title]" with ""
And I fill in "article[body]" with "This is my first article ever"
And I press "Create"
Then I should see the form for creating new articles
Scenario: Attempting to create a new article without a body
Given I have signed in as user "jenny" with a password of "password"
When I go to article admin page
When I follow "new_post"
And I fill in "article[title]" with "Sample title"
And I fill in "article[body]" with ""
And I press "Create"
Then I should see the form for creating new articles