Skip to content

Commit

Permalink
asset stories
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Jul 16, 2008
1 parent efe305a commit c793c4c
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 47 deletions.
11 changes: 11 additions & 0 deletions stories/steps/asset.rb
Expand Up @@ -17,6 +17,10 @@
When "the user fills in the admin asset edit form" do
fills_in 'asset[title]', :with => 'updated title'
end

When "the user adds an asset to the bucket" do
post "/admin/sites/#{@site.id}/assets/bucket?asset_id=#{@asset.id}"
end

Then "the page has an admin asset creation form" do
raise "this step expects the variable @site to be set" unless @site
Expand Down Expand Up @@ -52,4 +56,11 @@
Then "the asset is deleted" do
Asset.exists?(@asset.id).should be_false
end

Then "the asset is added to the bucket" do
session[:bucket].keys.should include(@asset.id)
end

Then "the asset immediately shows up on the page" do
end
end
1 change: 1 addition & 0 deletions stories/steps/authentication.rb
Expand Up @@ -9,6 +9,7 @@
end

Given "the user is logged in as $role" do |role|
User.delete_all!
@user = create_user :name => role, :email => "#{role}@email.org", :login => role
case role.to_sym
when :admin
Expand Down
2 changes: 1 addition & 1 deletion stories/steps/site.rb
Expand Up @@ -49,7 +49,7 @@
get edit_admin_site_path(@site)
end

When "the user visits the admin site index page" do
When "the user visits the admin site show page" do
get admin_site_path(@site)
end

Expand Down
63 changes: 34 additions & 29 deletions stories/stories/admin/asset.txt
@@ -1,41 +1,46 @@
# TODO
# add assets to bucket
# attach to article

Story: Managing assets
As an admin
I want to manage my site's assets
So I can get use them on the site

# Scenario: An admin views the assets list
# Given a site with no assets
# And the user is logged in as admin
# When the user visits admin sites assets list page
# Then the page has an empty list
#
# Scenario: An admin uploads, updates and deletes an asset
# Given a site with no assets
# And the user is logged in as admin
# When the user visits admin sites assets list page
# And the user clicks on 'New asset'
# Then the page has an admin asset creation form
# When the user fills in the admin asset creation form with valid values
# And the user clicks the 'Upload' button
# Then a new asset is saved
# And the user is redirected to admin sites assets list page
# Then the page has a list of assets with at least one asset
# When the user clicks on 'Edit'
# Then the page has an admin asset edit form
# When the user fills in the admin asset edit form
# And the user clicks the 'Save' button
# Then the asset is updated
# When the user clicks on 'Delete'
# Then the asset is deleted
Scenario: An admin views the assets list
Given a site with no assets
And the user is logged in as admin
When the user visits admin sites assets list page
Then the page has an empty list

Scenario: An admin uploads an asset
Given a site with no assets
And the user is logged in as admin
When the user visits admin sites assets list page
And the user clicks on 'New asset'
Then the page has an admin asset creation form
When the user fills in the admin asset creation form with valid values
And the user clicks the 'Upload' button
Then a new asset is saved
And the user is redirected to admin sites assets list page
Then the page has a list of assets with at least one asset

Scenario: An admin updates an asset
GivenScenario: An admin uploads an asset
When the user clicks on 'Edit'
Then the page has an admin asset edit form
When the user fills in the admin asset edit form
And the user clicks the 'Save' button
Then the asset is updated

Scenario: An admin deletes an asset
GivenScenario: An admin uploads an asset
When the user clicks on 'Delete'
Then the asset is deleted

Scenario: An admin adds an asset to the bucket
Given a site with an asset
And the user is logged in as admin
GivenScenario: An admin uploads an asset
When the user visits admin sites assets list page
And the user clicks on 'Add to bucket'
And the user adds an asset to the bucket
Then the asset is added to the bucket
And the asset immediately shows up on the page
And the asset immediately shows up on the page

13 changes: 13 additions & 0 deletions stories/stories/admin/plugin.txt
Expand Up @@ -18,4 +18,17 @@ Story: Managing a site's plugins
When the user fills in the plugin config edit form
And the user clicks the 'Save' button
Then the plugin's configuration is saved

Scenario: A superuser does not see a link to the plugins page before selecting a page
Given a site
And the user is logged in as superuser
When the user visits the admin sites list page
Then the page should not have 'Plugins' link

Scenario: A superuser should see a link to the plugins page after selecting a page
Given a site
And the user is logged in as superuser
When the user visits the admin site show page
Then the page should have 'Plugins' link


16 changes: 0 additions & 16 deletions stories/stories/superuser/plugin.txt

This file was deleted.

Expand Up @@ -4,7 +4,7 @@
<ul class="asset-tools" style="display: none;">
<li class="edit"><%= link_to 'Edit', edit_admin_asset_path(@site, asset), :title => 'Edit this file' %></li>
<li class="delete"><%= link_to 'Delete', admin_asset_path(@site, asset), :title => 'Delete this asset', :confirm => 'Are you sure you wish to delete this?', :method => :delete %></li>
<li class="bucket"><%= link_to_remote('Add to bucket', {:url => admin_assets_bucket_path(@site, :asset_id => asset.id)}, { :title => 'Add to bucket' }) %></li>
<li class="bucket"><%= link_to_remote('Add to bucket', { :url => admin_assets_bucket_path(@site, :asset_id => asset.id) }, { :title => 'Add to bucket' }) %></li>
</ul>
</div>

0 comments on commit c793c4c

Please sign in to comment.