engine/features/step_definitions/theme_asset_steps.rb

50 lines
1.4 KiB
Ruby
Raw Normal View History

### Theme assets
# helps create a theme asset
def create_plain_text_asset(name, type)
2011-08-25 21:28:56 +00:00
asset = FactoryGirl.build(:theme_asset, {
:site => @site,
:plain_text_name => name,
:plain_text => 'Lorem ipsum',
:plain_text_type => type,
:performing_plain_text => true
})
asset.save!
end
# creates various theme assets
Given /^a javascript asset named "([^"]*)"$/ do |name|
@asset = create_plain_text_asset(name, 'javascript')
end
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('..', 'fixtures', 'assets', '5k.png')))
@asset.source_filename = name
@asset.save!
end
# other stuff
# change the template
2012-02-28 10:25:51 +00:00
When /^I change the theme asset code to "([^"]*)"$/ do |plain_text|
page.evaluate_script "window.application_view.view.editor.setValue('#{plain_text}')"
end
2012-02-28 10:25:51 +00:00
Then /^I should see "([^"]*)" as the theme asset code$/ do |code|
find(:css, "#theme_asset_plain_text").value.should == code
end
Then /^I should see a delete link$/ do
page.has_css?(".box ul li .more a.remove").should be_true
end
Then /^I should not see a delete link$/ do
page.has_css?(".box ul li .more a.remove").should be_false
end