Skip to content

Commit

Permalink
initial commit with devise_bdd rails template
Browse files Browse the repository at this point in the history
  • Loading branch information
joahking committed Jan 9, 2010
0 parents commit dfd3fd2
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README
@@ -0,0 +1,4 @@
= Rails templates I use themost

* devise_bbd_template: Full BDD battery: RSpec, Cucumber with machinist[http://github.com/notahat/machinist] as fixture generator and devise[http://github.com/plataformatec/devise] as authentication solution

85 changes: 85 additions & 0 deletions devise_bdd_template.rb
@@ -0,0 +1,85 @@
# Delete unnecessary files
run 'rm README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/robots.txt'

run 'cp config/database.yml config/database.yml.example'

file '.gitignore', <<-END
log
tmp
config/database.yml
db/*.sqlite3
END

git :init
git :add => '.'
git :commit => "-a -m 'Initial commit'"

## auth
gem 'warden'
gem 'devise'

generate :devise_install

# rake("gems:unpack") ?

git :add => '.'
git :commit => "-a -m 'auth is on'"

## rspec
generate 'rspec'

file 'spec/my_spec_helper.rb', <<-MY_SPEC_HELPER
require File.expand_path(File.dirname(__FILE__) + '/blueprints')
require 'email_spec'
Spec::Runner.configure do |config|
config.before(:all) { Sham.reset(:before_all) }
config.before(:each) { Sham.reset(:before_each) }
config.include(EmailSpec::Helpers)
config.include(EmailSpec::Matchers)
end
MY_SPEC_HELPER

#TODO move this before the line Spec::Runner.configure do |config|
req_my_spec_helper = <<-REQ_MY_SPEC_HELPER
require 'my_spec_helper'
REQ_MY_SPEC_HELPER

File.open('spec/spec_helper.rb', 'a') do |spec_helper|
spec_helper.write req_my_spec_helper
end

file 'spec/blueprints.rb', <<-BLUEPRINTS
require 'machinist/active_record'
require File.expand_path(File.dirname(__FILE__) + '/shams')
# dump your blueprints here
BLUEPRINTS

file 'spec/shams.rb', <<-SHAMS
require 'sham'
require 'faker'
# dump your shams here
SHAMS

git :add => '.'
git :commit => "-a -m 'RSpec is on'"

## cucumber
generate 'cucumber'
gem 'email_spec', :env => :cucumber
generate 'email_spec'

file 'features/support/my_env.rb', <<-MY_ENV
require File.expand_path(File.dirname(__FILE__) + '../../../spec/blueprints')
require 'email_spec/cucumber'
MY_ENV

git :add => '.'
git :commit => "-a -m 'Cucumber is on'"

0 comments on commit dfd3fd2

Please sign in to comment.