Permalink
Browse files

test environment setup

  • Loading branch information...
1 parent c194c8c commit 6c8eda5c03645bb2d11f29871835f67c158dd321 @piotrmasior committed Apr 15, 2012
Showing with 231 additions and 8 deletions.
  1. +2 −0 .gitignore
  2. +2 −0 .rspec
  3. +17 −6 Gemfile
  4. +68 −0 Gemfile.lock
  5. +31 −0 Guardfile
  6. +49 −2 README.md
  7. +16 −0 db/schema.rb
  8. +46 −0 spec/spec_helper.rb
View
@@ -1,4 +1,6 @@
+.idea/
/.bundle
+coverage/
/log/*.log
/tmp
View
2 .rspec
@@ -0,0 +1,2 @@
+--colour
+--drb
View
23 Gemfile
@@ -2,19 +2,30 @@ source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'mysql2'
-
+gem 'jquery-rails'
+gem 'unicorn'
+gem 'capistrano'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
-
gem 'therubyracer', :platform => :ruby
-
gem 'uglifier', '>= 1.0.3'
end
-gem 'jquery-rails'
+group :development do
+ gem 'guard-rspec'
+ gem 'guard-spork'
+ gem 'libnotify'
+end
-gem 'unicorn'
+group :test do
+ gem 'rspec-rails'
+ gem 'ffaker'
+ gem 'factory_girl_rails', :require => false
+ gem 'spork'
+ gem 'simplecov', :require => false
+ gem 'database_cleaner'
+ gem 'capybara'
+end
-gem 'capistrano'
View
@@ -28,6 +28,7 @@ GEM
activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
+ addressable (2.2.7)
arel (3.0.2)
builder (3.0.0)
capistrano (2.12.0)
@@ -36,16 +37,42 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
+ capybara (1.1.2)
+ 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)
+ childprocess (0.3.1)
+ ffi (~> 1.0.6)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.1)
+ database_cleaner (0.7.2)
+ diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
+ factory_girl (3.1.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (3.1.0)
+ factory_girl (~> 3.1.0)
+ railties (>= 3.0.0)
+ ffaker (1.14.0)
+ ffi (1.0.11)
+ guard (1.0.1)
+ ffi (>= 0.5.0)
+ thor (~> 0.14.6)
+ guard-rspec (0.7.0)
+ guard (>= 0.10.0)
+ guard-spork (0.6.1)
+ guard (>= 0.10.0)
+ spork (>= 0.8.4)
highline (1.6.11)
hike (1.2.1)
i18n (0.6.0)
@@ -55,7 +82,10 @@ GEM
thor (~> 0.14)
json (1.6.6)
kgio (2.7.4)
+ libnotify (0.7.2)
libv8 (3.3.10.4)
+ libwebsocket (0.1.3)
+ addressable
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -70,6 +100,7 @@ GEM
net-ssh (2.3.0)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
+ nokogiri (1.5.2)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
@@ -97,11 +128,36 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
+ rspec (2.9.0)
+ rspec-core (~> 2.9.0)
+ rspec-expectations (~> 2.9.0)
+ rspec-mocks (~> 2.9.0)
+ rspec-core (2.9.0)
+ rspec-expectations (2.9.1)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.9.0)
+ rspec-rails (2.9.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.9.0)
+ rubyzip (0.9.7)
sass (3.1.15)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
+ selenium-webdriver (2.21.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0)
+ libwebsocket (~> 0.1.3)
+ multi_json (~> 1.0)
+ rubyzip
+ simplecov (0.6.1)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
+ spork (0.9.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
@@ -121,17 +177,29 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
capistrano
+ capybara
coffee-rails (~> 3.2.1)
+ database_cleaner
+ factory_girl_rails
+ ffaker
+ guard-rspec
+ guard-spork
jquery-rails
+ libnotify
mysql2
rails (= 3.2.3)
+ rspec-rails
sass-rails (~> 3.2.3)
+ simplecov
+ spork
therubyracer
uglifier (>= 1.0.3)
unicorn
View
@@ -0,0 +1,31 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'spork' do
+ watch('config/application.rb')
+ watch('config/environment.rb')
+ watch(%r{^config/environments/.*\.rb$})
+ watch(%r{^config/initializers/.*\.rb$})
+ watch('Gemfile')
+ watch('Gemfile.lock')
+ watch('spec/spec_helper.rb') { :rspec }
+ watch('test/test_helper.rb') { :test_unit }
+ watch(%r{features/support/}) { :cucumber }
+end
+
+guard 'rspec', :version => 2, :cli => "--drb --color --format doc", :all_after_pass => false, :all_on_start => false, :keep_failed => false do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+
+ # Rails example
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
+ watch('config/routes.rb') { "spec/routing" }
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
+ # Capybara request specs
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
+end
+
View
@@ -1,6 +1,6 @@
-== Getting Started
+# Lethal
-1. Create your rvm gemset with and adjust .rvmrc
+* Create your own rvm gemset with and adjust .rvmrc (ruby 1.9.3)
```
rvm gemset create lethal
@@ -10,3 +10,50 @@ gem install rails --no-ri --no-rdoc
bundle install
```
+
+* Adjust database config
+
+```
+cp config/database.yml.sample config/database.yml
+#edit via nano or whatever
+nano config/database.yml
+rake db:create && rake db:migrate
+```
+
+* Linux post-install
+
+```
+sudo apt-get install libnotify-bin
+```
+
+* Prepare
+
+```
+guard init rspec
+
+```
+consider change Guardfile
+```
+guard 'spork' do
+ watch('config/application.rb')
+ watch('config/environment.rb')
+ watch(%r{^config/environments/.*\.rb$})
+ watch(%r{^config/initializers/.*\.rb$})
+ watch('Gemfile')
+ watch('Gemfile.lock')
+ watch('spec/spec_helper.rb') { :rspec }
+ watch('test/test_helper.rb') { :test_unit }
+ watch(%r{features/support/}) { :cucumber }
+end
+
+guard 'rspec', :version => 2, :cli => "--drb --color --format doc", :all_after_pass => false, :all_on_start => false, :keep_failed => false do
+```
+
+
+* Start
+
+```
+bundle exec guard
+
+rails s
+```
View
@@ -0,0 +1,16 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 0) do
+
+end
View
@@ -0,0 +1,46 @@
+require 'rubygems'
+require 'spork'
+
+Spork.prefork do
+ unless ENV['DRB']
+ require 'simplecov'
+ SimpleCov.start 'rails'
+ end
+
+ ENV["RAILS_ENV"] ||= 'test'
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
+ require 'rspec/autorun'
+ require 'factory_girl_rails'
+
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+ RSpec.configure do |config|
+ config.use_transactional_fixtures = true
+ config.infer_base_class_for_anonymous_controllers = false
+ config.mock_with :rspec
+
+ config.before(:suite) do
+ DatabaseCleaner.strategy = :transaction
+ end
+ config.before(:each) do
+ DatabaseCleaner.start
+ end
+ config.after(:each) do
+ DatabaseCleaner.clean
+ end
+
+ ActiveSupport::Dependencies.clear
+
+ end
+
+end
+
+Spork.each_run do
+ if ENV['DRB']
+ require 'simplecov'
+ SimpleCov.start 'rails'
+ end
+ load "#{Rails.root}/config/routes.rb"
+ Dir["#{Rails.root}/app/**/*.rb"].each {|f| load f}
+end

0 comments on commit 6c8eda5

Please sign in to comment.