Skip to content

Commit

Permalink
Merge branch 'spanner/fix_cucumber'
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnflyer committed Jan 25, 2010
2 parents 334c151 + d793a7d commit d388295
Show file tree
Hide file tree
Showing 28 changed files with 488 additions and 384 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,3 +11,4 @@ public/stylesheets/admin/styles.css
spec/datasets/tmp
*.tmproj
.idea
rerun.txt
7 changes: 7 additions & 0 deletions config/cucumber.yml
@@ -0,0 +1,7 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
%>
default: <%= std_opts %>
wip: --tags @wip:3 --wip features
15 changes: 9 additions & 6 deletions config/environments/cucumber.rb
@@ -1,8 +1,10 @@
# IMPORTANT: This file was generated by Cucumber 0.4.4
# Edit at your own peril - it's recommended to regenerate this file
# in the future when you upgrade to a newer version of Cucumber.

config.cache_classes = true # This must be true for Cucumber to operate correctly!
# IMPORTANT: Setting config.cache_classes to false is known to
# break Cucumber's use_transactional_fixtures method.
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
config.cache_classes = true

# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
Expand All @@ -19,8 +21,9 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

config.gem 'cucumber', :lib => false, :version => '>=0.4.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
config.gem 'webrat', :lib => false, :version => '>=0.5.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
config.gem 'database_cleaner', :lib => false, :version => '>=0.4.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))

8 changes: 5 additions & 3 deletions config/environments/test.rb
Expand Up @@ -30,6 +30,8 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

config.gem "rspec-rails", :version => ">=1.2.9", :lib => false
config.gem "webrat", :version => ">=0.5.3", :lib => false
config.gem "cucumber", :version => ">=0.4.4", :lib => false
config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
config.gem 'database_cleaner', :lib => false, :version => '>=0.4.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
8 changes: 4 additions & 4 deletions features/admin/content_negotiation.feature
Expand Up @@ -6,19 +6,19 @@ Feature: Proper content negotiation
Scenario: Default to HTML format
Given I am logged in as "admin"
When I send an "Accept" header of "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
And I go to "/admin/pages"
And I go to the "pages" admin page
Then I should not see "Missing template"

Scenario: Requesting XML format via file-extension
Given I am logged in as "admin"
When I send an "Accept" header of "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
And I go to "/admin/pages.xml"
Then I should see "<\?xml"
And I go to the "pages" admin page as xml
Then I should see an xml document

Scenario: Requesting children via Ajax
Given I am logged in as "admin"
When I send an "Accept" header of "text/javascript, text/html, application/xml, text/xml, */*"
And I send an "X-Requested-With" header of "XMLHttpRequest"
And I request the children of page "home"
Then I should not see "Radiant CMS"
And I should see "<tr"
And I should see "<tr>" tags in the page source
27 changes: 16 additions & 11 deletions features/admin/pages_management.feature
Expand Up @@ -2,23 +2,23 @@ Feature: Managing pages
In order to create, modify, and delete content from the website
a content editor
wants to manipulate pages in the admin interface

Background:
Given I am logged in as "existing"

Scenario: Listing pages
When I go to "/admin/pages"
Given I am logged in as "existing"
When I go to the "pages" admin page
Then I should see "Pages"
And I should see "Home"

Scenario: No pages
Given I am logged in as "existing"
Given there are no pages
When I go to "/admin/pages"
When I go to the "pages" admin page
Then I should see "No Pages"

Scenario: Creating a homepage
Given I am logged in as "existing"
Given there are no pages
When I go to "/admin/pages"
When I go to the "pages" admin page
And I follow "New Homepage"
Then I should see "New Page"
And there should be a "body" part
Expand All @@ -32,11 +32,13 @@ Feature: Managing pages
And I press "Create page"
Then I should be on the sitemap
And I should see "My site"
When I go to "/"
When I go to the homepage
Then I should see "Under Construction"

Scenario: Creating child pages
When I go to "/admin/pages"
Given I am logged in as "existing"
And there is a homepage
When I go to the "pages" admin page
And I follow "Add child"
Then I should see "New Page"
And there should be a "body" part
Expand All @@ -50,23 +52,26 @@ Feature: Managing pages
And I press "Save and Continue Editing"
Then I should see "Edit Page"
And I should see "Under Construction"
When I go to "/my-child"
When I go to the new child page
Then I should see "Under Construction"

Scenario: Delete page
When I go to "/admin/pages"
Given I am logged in as "existing"
When I go to the "pages" admin page
And I follow "remove page"
Then I should see "permanently remove"
When I press "Delete Pages"
Then I should see "No Pages"

Scenario: View a page
Given I am logged in as "existing"
When I view a page
Then I should see "Edit Page"

Scenario: Change page type
Given I am logged in as "existing"
When I edit the "virtual" page
And I select "&lt;normal&gt;" from "Page type"
And I select "<normal>" from "Page type"
And I press "Save and Continue Editing"
Then I should see "Edit Page"
And "&lt;normal&gt;" should be selected for "Page type"
11 changes: 6 additions & 5 deletions features/admin/snippets_management.feature
Expand Up @@ -6,15 +6,16 @@ Feature: Managing snippets
Given I am logged in as "designer"

Scenario: List snippets
When I follow "Design" within "navigation"
Then show me the page
When I follow "Design" within "#navigation"
And I follow "Snippets"
Then I should see "first"
And I should see "another"
And I should see "markdown"
# And a host of others

Scenario: Create a snippet
When I follow "Design" within "navigation"
When I follow "Design" within "#navigation"
And I follow "Snippets"
And I follow "New Snippet"
And I fill in "Name" with "Mine"
Expand All @@ -24,7 +25,7 @@ Feature: Managing snippets
And I should see "Mine"

Scenario: Display form errors
When I follow "Design" within "navigation"
When I follow "Design" within "#navigation"
And I follow "Snippets"
And I follow "New Snippet"
And I fill in "Body" with "My snippet"
Expand All @@ -33,7 +34,7 @@ Feature: Managing snippets
And I should see the form

Scenario: Continue editing
When I follow "Design" within "navigation"
When I follow "Design" within "#navigation"
And I follow "Snippets"
And I follow "New Snippet"
And I fill in "Name" with "Mine"
Expand All @@ -47,7 +48,7 @@ Feature: Managing snippets
Then I should see "Edit Snippet"

Scenario: Delete a snippet with confirmation
When I follow "Design" within "navigation"
When I follow "Design" within "#navigation"
And I follow "Snippets"
And I follow "Remove Snippet"
Then I should see "permanently remove"
Expand Down
18 changes: 9 additions & 9 deletions features/admin/user_permissions.feature
Expand Up @@ -4,7 +4,7 @@ Feature: User authentication and permissions
users should be given different access permissions

Scenario Outline: Authentication-login
When I go to "/admin/login"
When I go to the login page
And I fill in "Username" with "<username>"
And I fill in "Password" with "password"
And I press "Login"
Expand All @@ -31,7 +31,7 @@ Feature: User authentication and permissions
Scenario Outline: All users can edit pages
Given I am logged in as "<username>"
And I should see "Pages"
When I go to "/admin/pages"
When I go to the "pages" admin page
And I follow "Home"
Then I should see "Edit Page"
And I should see "Pages"
Expand All @@ -45,7 +45,7 @@ Feature: User authentication and permissions
Scenario Outline: Admins and designers can see and edit snippets
Given I am logged in as "<username>"
And I should see "Design"
When I follow "Design" within "navigation"
When I follow "Design" within "#navigation"
And I follow "Snippets"
And I should not see "You must have designer privileges"
And I follow "first"
Expand All @@ -59,7 +59,7 @@ Feature: User authentication and permissions
Scenario Outline: Admins and designers can see and edit layouts
Given I am logged in as "<username>"
And I should see "Design"
When I follow "Design" within "navigation"
When I follow "Design" within "#navigation"
And I follow "Layouts"
And I should not see "You must have designer privileges"
And I follow "Main"
Expand All @@ -73,7 +73,7 @@ Feature: User authentication and permissions
Scenario Outline: Ordinary users cannot edit layouts
Given I am logged in as "<username>"
And I should not see "Design"
When I go to "/admin/layouts"
When I go to the "layouts" admin page
Then I should see "You must have designer privileges"

Examples:
Expand All @@ -84,7 +84,7 @@ Feature: User authentication and permissions
Scenario Outline: Ordinary users cannot edit snippets
Given I am logged in as "<username>"
And I should not see "Design"
When I go to "/admin/snippets"
When I go to the "snippets" admin page
Then I should see "You must have designer privileges"

Examples:
Expand All @@ -103,7 +103,7 @@ Feature: User authentication and permissions
Scenario Outline: Non-admins cannot see or edit users
Given I am logged in as "<username>"
And I should not see "Users"
When I go to "/admin/users"
When I go to the "users" admin page
Then I should see "You must have administrative privileges"

Examples:
Expand Down Expand Up @@ -135,7 +135,7 @@ Feature: User authentication and permissions
Given I am logged in as "<username>"
When I follow "Settings"
And I should not see "Extensions"
When I go to "/admin/extensions"
When I go to the "extensions" admin page
Then I should see "You must have administrative privileges"

Examples:
Expand All @@ -146,7 +146,7 @@ Feature: User authentication and permissions

Scenario Outline: Anyone can export YAML
Given I am logged in as "<username>"
When I go to "/admin/export"
When I go to the export page
Then I should see "id:"

Examples:
Expand Down
2 changes: 1 addition & 1 deletion features/admin/user_preferences.feature
Expand Up @@ -14,5 +14,5 @@ Feature: Edit user preferences
| admin |
| another |
| existing |
| designer |
| designer |
| non_admin |
2 changes: 1 addition & 1 deletion features/admin/users_management.feature
Expand Up @@ -4,7 +4,7 @@ Feature: Managing users

Background:
Given I am logged in as "admin"
And I go to "/admin/users"
And I go to the "users" admin page
Scenario: Listing users
Then I should see "Admin"
And I should see "Designer"
Expand Down
16 changes: 8 additions & 8 deletions features/page_serving.feature
Expand Up @@ -7,36 +7,36 @@ Feature: Serving pages from front-end
Given the page cache is clear

Scenario: Basic page rendering
When I go to page "/first"
When I go to the first page
Then I should get a 200 response code
And I should see "First body."

Scenario: Rendering deeply nested page
When I go to page "/parent/child/grandchild/great-grandchild"
When I go to the great-grandchild page
Then I should get a 200 response code
And I should see "Great Grandchild body."

Scenario: Apache/lighttpd acceleration
Given I have turned on X-Sendfile headers
When I go to page "/first"
And I go to page "/first"
When I go to the first page
And I go to the first page
Then I should get an "X-Sendfile" header in the response

Scenario: nginx acceleration
Given I have turned on X-Accel-Redirect headers
When I go to page "/first"
And I go to page "/first"
When I go to the first page
And I go to the first page
Then I should get an "X-Accel-Redirect" header in the response

Scenario: page caching enabled
Given I have page caching on
When I go to page "/first"
When I go to the first page
Then I should get an "ETag" header in the response
And The "Cache-Control" header should be "public"

Scenario: page caching disabled
Given I have page caching off
When I go to page "/first"
When I go to the first page
Then I should not get an "ETag" header in the response
And The "Cache-Control" header should be "private"

10 changes: 8 additions & 2 deletions features/step_definitions/admin/admin_steps.rb
@@ -1,7 +1,7 @@
Given(/^I am logged in as "([^\"]*)"$/) do |user|
puts "The user, #{user}, does not exist" if users(user.to_sym).nil?
visit '/admin/login'
@user = users(user.intern)
fill_in 'Username', :with => @user.login
fill_in 'Username', :with => user
fill_in 'Password', :with => 'password'
click_button 'Login'
end
Expand All @@ -11,6 +11,12 @@
PagePart.delete_all
end

Given /^there is a homepage$/ do
page = Page.new_with_defaults
page.title = "Homepage"
page.save
end

Then /^"([^\"]*)" should be selected for "([^\"]*)"$/ do |value, field|
select_box = field_labeled(field)
response.should have_tag("select##{select_box.id}") do
Expand Down

0 comments on commit d388295

Please sign in to comment.