fix the cucumber tests for pages

This commit is contained in:
Didier Lafforgue 2012-02-17 09:56:11 +01:00
parent 4269a00985
commit ecf6998a68
2 changed files with 13 additions and 3 deletions

View File

@ -23,13 +23,12 @@ Scenario: Creating a valid page
Then I should see "Page was successfully created."
And I should have "{% extends 'parent' %}" in the test page
@wip
@javascript
Scenario: Updating a valid page
When I go to pages
And I follow "Home page"
And I fill in "page_title" with "Home page !"
And I fill in "Raw template" with "My new content is here"
And I change the page title with "Home page !"
And I change the page template with "My new content is here"
And I press "Save"
Then I should see "Page was successfully updated."
And I should have "My new content is here" in the index page

View File

@ -17,6 +17,17 @@ Given /^a page named "([^"]*)" with the template:$/ do |page_slug, template|
@page = create_content_page(page_slug, '', template)
end
# change the title
When /^I change the page title with "([^"]*)"$/ do |page_title|
page.evaluate_script "window.prompt = function() { return '#{page_title}'; }"
page.find('h2 a.editable').click
end
# change the template
When /^I change the page template with "([^"]*)"$/ do |page_template|
page.evaluate_script "window.application_view.view.model.set({ 'raw_template': '#{page_template}' })"
end
# update a page
When /^I update the "([^"]*)" page with the template:$/ do |page_slug, template|
page = @site.pages.where(:slug => page_slug).first