2011-02-04 09:39:23 +00:00
|
|
|
Feature: Manage Theme Assets
|
|
|
|
In order to manage theme assets
|
|
|
|
As an administrator
|
|
|
|
I want to add/edit/delete theme assets of my site
|
|
|
|
|
|
|
|
Background:
|
|
|
|
Given I have the site: "test site" set up
|
|
|
|
And I am an authenticated user
|
|
|
|
|
|
|
|
Scenario: Theme assets list is not accessible for non authenticated accounts
|
|
|
|
Given I am not authenticated
|
|
|
|
When I go to theme assets
|
|
|
|
Then I should see "Log in"
|
|
|
|
|
|
|
|
Scenario: Uploading a valid image
|
|
|
|
When I go to theme assets
|
|
|
|
And I follow "new file"
|
|
|
|
And I attach the file "spec/fixtures/assets/5k.png" to "File"
|
|
|
|
And I press "Create"
|
|
|
|
Then I should see "File was successfully created."
|
|
|
|
And I should not see "Code"
|
|
|
|
And I should see "images/5k.png"
|
|
|
|
|
|
|
|
Scenario: Uploading a stylesheet
|
|
|
|
When I go to theme assets
|
|
|
|
And I follow "new file"
|
|
|
|
And I attach the file "spec/fixtures/assets/main.css" to "File"
|
|
|
|
And I press "Create"
|
|
|
|
Then I should see "File was successfully created."
|
|
|
|
And I should see "Code"
|
|
|
|
And I should see "stylesheets/main.css"
|
|
|
|
|
2011-06-27 15:27:07 +00:00
|
|
|
Scenario: Updating a stylesheet
|
|
|
|
Given a stylesheet asset named "application"
|
2011-02-04 09:39:23 +00:00
|
|
|
When I go to theme assets
|
2011-06-27 15:27:07 +00:00
|
|
|
And I follow "stylesheets/application.css"
|
|
|
|
And I fill in "theme_asset[plain_text]" with "Lorem ipsum (updated)"
|
2011-07-22 23:26:16 +00:00
|
|
|
And I press "Save"
|
2011-06-27 15:27:07 +00:00
|
|
|
Then I should see "File was successfully updated."
|
|
|
|
And I should see "Editing application.css"
|
|
|
|
And I should see "application.css"
|
|
|
|
And I should see "Lorem ipsum (updated)" as theme asset code
|
2011-02-04 09:39:23 +00:00
|
|
|
|
|
|
|
Scenario: Uploading a javascript
|
|
|
|
When I go to theme assets
|
|
|
|
And I follow "new file"
|
|
|
|
And I fill in "Folder" with "javascripts/test"
|
|
|
|
And I attach the file "spec/fixtures/assets/application.js" to "File"
|
|
|
|
And I press "Create"
|
|
|
|
Then I should see "File was successfully created."
|
|
|
|
And I should see "Code"
|
|
|
|
And I should see "javascripts/test/application.js"
|
|
|
|
|
2011-06-28 13:38:13 +00:00
|
|
|
Scenario: Updating a javascript
|
|
|
|
Given a javascript asset named "application"
|
|
|
|
When I go to theme assets
|
|
|
|
And I follow "javascripts/application.js"
|
|
|
|
And I fill in "theme_asset[plain_text]" with "Lorem ipsum (updated)"
|
2011-07-22 23:26:16 +00:00
|
|
|
And I press "Save"
|
2011-06-28 13:38:13 +00:00
|
|
|
Then I should see "File was successfully updated."
|
|
|
|
|
2011-02-04 09:39:23 +00:00
|
|
|
Scenario: Uploading an image which already exists
|
|
|
|
When I go to theme assets
|
|
|
|
And I follow "new file"
|
|
|
|
And I attach the file "spec/fixtures/assets/5k.png" to "File"
|
|
|
|
And I press "Create"
|
|
|
|
And I follow "new file"
|
|
|
|
And I attach the file "spec/fixtures/assets/5k.png" to "File"
|
|
|
|
And I press "Create"
|
|
|
|
Then I should see "File was not created."
|