Merge branch 'feature/aloha_integration_tests'

This commit is contained in:
Mario Visic 2011-09-03 22:38:16 +08:00
commit 1b86150042
5 changed files with 44 additions and 25 deletions

View File

@ -56,7 +56,7 @@ end
group :test, :development do
gem 'linecache', '0.43', :platforms => :mri_18
gem 'ruby-debug', :platforms => :mri_18
gem 'ruby-debug19', :platforms => :mri_19
gem 'ruby-debug19', :platforms => :mri_19, :require => 'ruby-debug'
gem 'bushido_stub', '0.0.3'

View File

@ -16,21 +16,3 @@ Scenario: Simple Page
"""
Hello World
"""
# @wip
# Scenario: Simple Page with Admin Inline Editing
# Given a simple page named "hello-world-inline" with the body:
# """
# {% block hello %}Hello World{% endblock %}
# """
# When And I'm an admin
# And I view the rendered page at "/hello-world-inline"
# Then the rendered output shoud look like:
# """
# <div class="inline-editing" data-url="/admin/parts/XXXX" data-title="hello">Hello World</div>
# """
#
# {% block main %}Didier{% endblock %}
#
# {% block body %}{% block main %}{{ block.super }}Jacques{% endblock %}{% endblock %}
# {% block body %}Hello mister Jacques{% endblock %}

View File

@ -0,0 +1,25 @@
@javascript
Feature: Engine
As an author
In order to easily be able to modify the contents of my website
I want to be able to edit the sites content on the front end
Background:
Given I have the site: "test site" set up
And I am an authenticated "author"
Scenario: Editing a short text field
Given a page named "about" with the template:
"""
<html>
<head>{% inline_editor %}</head>
<body>{% editable_short_text 'owner' %}Tom{% endeditable_short_text %} owns this website</body>
</html>
"""
When I view the rendered page at "/about"
Then I should see "edit"
When I follow "edit"
And I type the content "Mario" into the first editable field
And I follow "save"
And I view the rendered page at "/about"
Then I should see "Mario owns this website"

View File

@ -1,7 +1,3 @@
Given /^a simple page named "([^"]*)" with the body:$/ do |page_slug, page_contents|
@page = create_content_page(page_slug, page_contents)
end
# modify an editable element
Given /^the editable element "([^"]*)" in the "([^"]*)" page with the content "([^"]*)"$/ do |slug, page_slug, content|
page = @site.pages.where(:slug => page_slug).first
@ -14,4 +10,15 @@ Given /^the editable element "([^"]*)" for the "([^"]*)" block in the "([^"]*)"
page = @site.pages.where(:slug => page_slug).first
page.find_editable_element(block, slug).content = content
page.save!
end
end
When /^I type the content "([^"]*)" into the first editable field$/ do |content|
page.execute_script %{
$(document).ready(function() {
editable = GENTICS.Aloha.editables[0];
editable.obj.text('#{content}');
editable.blur();
});
}
end

View File

@ -26,7 +26,12 @@ end
# try to render a page by slug
When /^I view the rendered page at "([^"]*)"$/ do |path|
visit "http://#{@site.domains.first}#{path}"
# If we're running selenium then we need to use a differnt port
if Capybara.current_driver == :selenium
visit "http://#{@site.domains.first}:#{Capybara.server_port}#{path}"
else
visit "http://#{@site.domains.first}#{path}"
end
end
# checks to see if a string is in the slug