This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Initial commit: testing application for specs

  • Loading branch information...
jferris committed Dec 22, 2010
0 parents commit 44c960c5f13eb1a2d4a9c0319148b33e252d8a10
@@ -0,0 +1,6 @@
+*.swp
+*.swo
+*~
+tmp
+*.sqlite3
+.bundle
@@ -0,0 +1,9 @@
+source "http://rubygems.org"
+gem "cucumber"
+gem "aruba"
+gem "rake"
+gem "rspec-rails", :require => false
+gem "rails", ">= 3.0.3", :require => false
+gem "thin"
+gem "sqlite3-ruby", :require => false
+
@@ -0,0 +1,113 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ arel (2.0.6)
+ aruba (0.2.7)
+ background_process
+ cucumber (~> 0.10.0)
+ background_process (1.2)
+ builder (2.1.2)
+ cucumber (0.10.0)
+ builder (>= 2.1.2)
+ diff-lcs (~> 1.1.2)
+ gherkin (~> 2.3.2)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ daemons (1.1.0)
+ diff-lcs (1.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ eventmachine (0.12.10)
+ gherkin (2.3.2)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ i18n (0.5.0)
+ json (1.4.6)
+ mail (2.2.12)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+ rspec-rails (2.3.1)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.3.0)
+ sqlite3-ruby (1.3.2)
+ term-ansicolor (1.0.5)
+ thin (1.2.7)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ aruba
+ cucumber
+ rails (>= 3.0.3)
+ rake
+ rspec-rails
+ sqlite3-ruby
+ thin
@@ -0,0 +1,28 @@
+Gem::Specification.new do |s|
+ s.name = %q{diesel}
+ s.version = '0.1.8'
+ s.summary = %q{Diesel makes your engine go.}
+ s.description = %q{Develop your Rails engines like you develop your Rails applications.}
+
+ s.files = Dir['[A-Z]*',
+ 'config/**/*',
+ 'app/**/*',
+ 'lib/**/*.rb',
+ 'features/**/*',
+ 'lib/generators/**/*',
+ 'bin/**/*',
+ 'spec/**/*.rb']
+ s.require_path = 'lib'
+ s.test_files = Dir['features/**/*']
+
+ s.has_rdoc = false
+
+ s.authors = ["thoughtbot, inc.", "Joe Ferris"]
+ s.email = %q{support@thoughtbot.com}
+ s.homepage = "http://github.com/thoughtbot/diesel"
+
+ s.add_dependency('railties', '~> 3.0.3')
+
+ s.platform = Gem::Platform::RUBY
+ s.rubygems_version = %q{1.2.0}
+end
@@ -0,0 +1,52 @@
+@disable-bundler @puts @announce
+Feature: test a diesel engine using rspec
+
+ Scenario: create a disel engine and test using rspec
+ Given a directory named "testengine"
+ When I cd to "testengine"
+ And I write to "Gemfile" with:
+ """
+ gem "rspec-rails", "~> 2.3.0"
+ gem "rails", "~> 3.0.3"
+ gem "sqlite3-ruby"
+ """
+ When I add this library as a dependency
+ And I write to "spec/controllers/example_controller_spec.rb" with:
+ """
+ ENV["RAILS_ENV"] ||= 'test'
+ require "diesel/testing"
+ require 'rspec/rails'
+
+ describe ExampleController do
+ it "renders hello" do
+ get :hello
+ response.should be_success
+ response.should render_template("hello")
+ end
+ end
+ """
+ When I write to "app/controllers/example_controller.rb" with:
+ """
+ class ExampleController < ActionController::Base
+ def hello
+ render
+ end
+ end
+ """
+ When I write to "app/views/example/hello.html.erb" with:
+ """
+ hello!
+ """
+ When I write to "config/routes.rb" with:
+ """
+ Rails.application.routes.draw do
+ match "/hello", :to => 'example#hello'
+ end
+ """
+ When I run "bundle exec rspec --format documentation spec"
+ Then it should pass with:
+ """
+ 0 failures
+ """
+ Then at least one example should have run
+
@@ -0,0 +1,8 @@
+When /^I add this library as a dependency$/ do
+ append_to_file('Gemfile', %{\ngem "diesel", :path => "#{PROJECT_ROOT}"})
+end
+
+Then /^at least one example should have run$/ do
+ Then %{the output should match /[1-9]0? examples?/}
+end
+
@@ -0,0 +1,3 @@
+require 'aruba/cucumber'
+
+PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
@@ -0,0 +1,4 @@
+require 'diesel/testing/application'
+
+Diesel::Testing::Application.initialize!
+
@@ -0,0 +1,23 @@
+require 'rails/all'
+
+module Diesel
+ module Testing
+ APP_ROOT = File.expand_path('..', __FILE__).freeze
+
+ class Application < Rails::Application
+ config.encoding = "utf-8"
+ config.action_mailer.default_url_options = { :host => 'localhost' }
+ config.paths.config.database = "#{APP_ROOT}/database.yml"
+ config.paths.log = "tmp/log"
+ config.cache_classes = true
+ config.whiny_nils = true
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.action_dispatch.show_exceptions = false
+ config.action_controller.allow_forgery_protection = false
+ config.action_mailer.delivery_method = :test
+ config.active_support.deprecation = :stderr
+ end
+ end
+end
+
@@ -0,0 +1,6 @@
+test: &test
+ adapter: sqlite3
+ database: tmp/test.sqlite3
+ pool: 5
+ timeout: 5000
+

0 comments on commit 44c960c

Please sign in to comment.