Skip to content

Commit

Permalink
Rails 3.1 base
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheworiordan committed Nov 7, 2011
0 parents commit d8288c8
Show file tree
Hide file tree
Showing 59 changed files with 10,099 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Gemfile
@@ -0,0 +1,22 @@
source 'http://rubygems.org'

gem 'rails', '~>3.1'

gem 'sqlite3'

group :test do
gem 'cucumber'
gem 'cucumber-rails'
gem 'capybara'
gem 'capybara-webkit'
gem 'capybara-screenshot', '~>0.1'
gem 'rspec'
end

group :development, :test do
if RUBY_VERSION =~ /^1\.8\.[\d]+$/
gem 'ruby-debug'
else
gem 'ruby-debug19'
end
end
152 changes: 152 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,152 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.1)
actionpack (= 3.1.1)
mail (~> 2.3.0)
actionpack (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.2)
activemodel (3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
activesupport (3.1.1)
multi_json (~> 1.0)
arel (2.2.1)
builder (3.0.0)
capybara (1.1.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
capybara-screenshot (0.1.0)
capybara (>= 1.0)
cucumber (>= 1.0)
capybara-webkit (0.7.2)
capybara (>= 1.0.0, < 1.2)
childprocess (0.2.2)
ffi (~> 1.0.6)
columnize (0.3.4)
cucumber (1.1.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.6.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
cucumber-rails (1.2.0)
capybara (>= 1.1.1)
cucumber (>= 1.1.1)
nokogiri (>= 1.5.0)
diff-lcs (1.1.3)
erubis (2.7.0)
ffi (1.0.9)
gherkin (2.6.2)
json (>= 1.4.6)
hike (1.2.1)
i18n (0.6.0)
json (1.6.1)
json_pure (1.6.1)
linecache (0.46)
rbx-require-relative (> 0.0.4)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.3)
nokogiri (1.5.0)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.1)
actionmailer (= 3.1.1)
actionpack (= 3.1.1)
activerecord (= 3.1.1)
activeresource (= 3.1.1)
activesupport (= 3.1.1)
bundler (~> 1.0)
railties (= 3.1.1)
railties (3.1.1)
actionpack (= 3.1.1)
activesupport (= 3.1.1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rbx-require-relative (0.0.5)
rdoc (3.11)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
rubyzip (0.9.4)
selenium-webdriver (2.10.0)
childprocess (>= 0.2.1)
ffi (= 1.0.9)
json_pure
rubyzip
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.4)
term-ansicolor (1.0.7)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
xpath (0.1.4)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
capybara
capybara-screenshot (~> 0.1)
capybara-webkit
cucumber
cucumber-rails
rails (~> 3.1)
rspec
ruby-debug
sqlite3
19 changes: 19 additions & 0 deletions LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2011 Matthew O'Riordan, inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
@@ -0,0 +1,20 @@
capybara-screenshot gem sample test application
===============================================

This is a simple rails application which demonstrates using the [capybara-screenshot gem](https://github.com/mattheworiordan/capybara-screenshot).

Run the cucumber tests `bundle exec cucumber` to test the Gem and generate source code and screen shots (when using [capybara-webkit](https://github.com/thoughtbot/capybara-webkit)) from failing scenarios into /tmp/capybara.

About
-----

This test application was written by **Matthew O'Riordan**

- [http://mattheworiordan.com](http://mattheworiordan.com)
- [@mattheworiordan](http://twitter.com/#!/mattheworiordan)
- [Linked In](http://www.linkedin.com/in/lemon)

License
-------

Copyright © 2011 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
7 changes: 7 additions & 0 deletions Rakefile
@@ -0,0 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

CapybaraScreenshotTest::Application.load_tasks
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
2 changes: 2 additions & 0 deletions app/controllers/welcome_controller.rb
@@ -0,0 +1,2 @@
class WelcomeController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
module ApplicationHelper
end
12 changes: 12 additions & 0 deletions app/views/layouts/application.html.erb
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>CapybaraScreenshotTest</title>
<%= csrf_meta_tag %>
</head>
<body>

<%= yield %>

</body>
</html>
3 changes: 3 additions & 0 deletions app/views/welcome/index.html.erb
@@ -0,0 +1,3 @@
<h1>Cucumber test</h1>

Run the cucumber tests `bundle exec cucumber` to test the Gem and generate source code and screen shots (when using capybara-webkit) from failing scenarios into /tmp/capybara.
1 change: 1 addition & 0 deletions app/views/welcome/rack.html.erb
@@ -0,0 +1 @@
<h1>Rack</h1>
4 changes: 4 additions & 0 deletions app/views/welcome/selenium.html.erb
@@ -0,0 +1,4 @@
<h1 id="title">Selenium</h1>
<script language="javascript">
document.getElementById('title').innerHTML += ' supports Javascript';
</script>
4 changes: 4 additions & 0 deletions app/views/welcome/webkit.html.erb
@@ -0,0 +1,4 @@
<h1 id="title">Webkit</h1>
<script language="javascript">
document.getElementById('title').innerHTML += ' supports Javascript';
</script>
4 changes: 4 additions & 0 deletions config.ru
@@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
run CapybaraScreenshotTest::Application
48 changes: 48 additions & 0 deletions config/application.rb
@@ -0,0 +1,48 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'

if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end

module CapybaraScreenshotTest
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]

# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]

# Enable the asset pipeline
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end
6 changes: 6 additions & 0 deletions config/boot.rb
@@ -0,0 +1,6 @@
require 'rubygems'

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
8 changes: 8 additions & 0 deletions config/cucumber.yml
@@ -0,0 +1,8 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
25 changes: 25 additions & 0 deletions config/database.yml
@@ -0,0 +1,25 @@
# SQLite version 3.x
# gem install sqlite3
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000

production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

cucumber:
<<: *test
5 changes: 5 additions & 0 deletions config/environment.rb
@@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
CapybaraScreenshotTest::Application.initialize!

0 comments on commit d8288c8

Please sign in to comment.