Skip to content

Instantly share code, notes, and snippets.

@samflores
Created April 18, 2011 02:22
Show Gist options
  • Save samflores/924700 to your computer and use it in GitHub Desktop.
Save samflores/924700 to your computer and use it in GitHub Desktop.
gem install bundler padrino
padrino gen project myapp -d none -t rspec
source :rubygems
# Project requirements
gem 'rake'
gem 'rack-flash'
gem 'thin' # or mongrel
# Component requirements
gem 'compass', '~> 0.11.beta.6'
gem 'sass', '~> 3.1.0.alpha.253'
gem 'slim'
gem 'ripple'
# Test requirements
group :test do
gem 'ffaker'
gem 'rspec'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git', :require => %w(capybara capybara/rspec)
# I know capybara adds a lot of dependencies... maybe the problem are there
gem 'spork', '~> 0.9.0.rc5'
gem 'guard'
gem 'guard-rspec'
gem 'rb-fsevent'
gem 'growl'
gem 'rack-test', :require => 'rack/test'
end
# Padrino
gem 'padrino', '0.9.23'
# then run `bundle install`
# tells guard what to do when a files is modified
guard 'rspec', :version => 2, :cli => '--drb -I.' 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('spec/spec_helper.rb') { "spec" }
watch(%r{^spec/.+_spec\.rb})
watch(%r{^app/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)\.rb}) { |m|
[
"spec/routing/#{m[1]}_routing_spec.rb",
"spec/controllers/#{m[1]}_controller_spec.rb",
"spec/acceptance/#{m[1]}_spec.rb"
]
}
end
require 'spec/spec_helper'
# this is the content of other file (acceptance_helper.rb) require in each spec
Capybara.app = Sinatra::Application
RSpec.configure do |config|
config.include Capybara::DSL
config.before :each do
# do something before each acceptance test
end
end
feature 'some incredible feature' do
scenario 'first scenario'
scenario 'second scenario'
scenario 'third scenario'
scenario 'fourth scenario'
# actually there are 3 files with specs, but they're all pending like these
end
spork & guard
# MRI 1.9.2 p180
# Finished in 0.00931 seconds
# 9 examples, 0 failures, 9 pending
# Rubinius 1.2.4dev
# Finished in 1.96 seconds
# 9 examples, 0 failures, 9 pending
# and there's other issue I'm not sure is related with Rubinius. Guard seems to stop watching files modifications after first run (but works fine with MRI)
# after running `spork --bootstrap` edit the spec_helper file to looks like:
require 'rubygems'
require 'spork'
Spork.prefork do
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
require File.expand_path(File.dirname(__FILE__) + '/../config/boot')
RSpec.configure do |conf|
conf.include Rack::Test::Methods
end
def app
Myapp.tap { |app| }
end
end
Spork.each_run do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment