Added a failing cucumber test for viewing the delete asset button as an author.

This commit is contained in:
Mario Visic 2011-08-20 17:08:37 +08:00
parent 0e3d601ea9
commit 0ed6c21f10
2 changed files with 23 additions and 1 deletions

View File

@ -6,6 +6,7 @@ Feature: Theme Assets
Background:
Given I have the site: "test site" set up
And I have a designer and an author
And I have an image theme asset named "dog.png"
Scenario: As an unauthenticated user
Given I am not authenticated
@ -20,6 +21,8 @@ Background:
And I should see "Snippets"
And I should see "Style and javascript"
And I should see "Images"
And I should see "dog.png"
And I should see a delete image button
Scenario: Accessing theme assets as a Designer
Given I am an authenticated "designer"
@ -29,6 +32,8 @@ Background:
And I should see "Snippets"
And I should see "Style and javascript"
And I should see "Images"
And I should see "dog.png"
And I should see a delete image button
Scenario: Accessing theme assets as an Author
Given I am an authenticated "author"
@ -38,3 +43,5 @@ Background:
And I should not see "Snippets"
And I should not see "Style and javascript"
And I should see "Images"
And I should see "dog.png"
And I should not see a delete image button

View File

@ -24,8 +24,23 @@ Given /^a stylesheet asset named "([^"]*)"$/ do |name|
@asset = create_plain_text_asset(name, 'stylesheet')
end
Given /^I have an image theme asset named "([^"]*)"$/ do |name|
@asset = FactoryGirl.create(:theme_asset, :site => @site, :source => File.open(Rails.root.join('spec', 'fixtures', 'assets', '5k.png')))
@asset.source_filename = name
@asset.save!
end
# other stuff
Then /^I should see "([^"]*)" as theme asset code$/ do |code|
find(:css, "#theme_asset_plain_text").text.should == code
end
end
Then /^I should see a delete image button$/ do
page.has_css?("ul.theme-assets li .more a.remove").should be_true
end
Then /^I should not see a delete image button$/ do
page.has_css?("ul.theme-assets li .more a.remove").should be_false
end