Navigation Menu

Skip to content

Commit

Permalink
Remove test run and other goodies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Mar 15, 2011
1 parent 48b2db3 commit f23369c
Show file tree
Hide file tree
Showing 47 changed files with 58 additions and 1,127 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.gem
.bundle
Gemfile.lock
./test_run
pkg/*
25 changes: 24 additions & 1 deletion recipes/activerecord.rb
@@ -1,4 +1,15 @@
# No additional code required.
config['database'] = 'oracle'

after_bundler do
if config['database']
say_wizard "Configuring '#{config['database']}' database settings..."
old_gem = gem_for_database
@options[:database] = config['database']
gsub_file "gem '#{old_gem}'", "gem '#{gem_for_database}'"
template "config/databases/#{@options[:database]}.yml", "config/database.yml"
rake "db:create:all"
end
end

__END__

Expand All @@ -9,3 +20,15 @@
exclusive: orm
category: persistence
tags: [sql, defaults, orm]

config:
- database:
type: multiple_choice
prompt: "Which database are you using?"
choices:
- ["MySQL", mysql]
- ["Oracle", oracle]
- ["PostgreSQL", postgresql]
- ["SQLite", sqlite3]
- ["Frontbase", frontbase]
- ["IBM DB", ibm_db]
21 changes: 19 additions & 2 deletions recipes/capybara.rb
@@ -1,8 +1,24 @@
gem 'steak', '>= 1.0.0.rc.1'
gem 'capybara'

after_bundler do
generate 'steak:install'
create_file "spec/support/capybara.rb", <<-RUBY
require 'capybara/rails'
require 'capbybara/rspec'
RUBY

create_file "spec/requests/home_spec.rb", <<-RUBY
require 'spec_helper'
describe 'visiting the homepage' do
before do
visit '/'
end
it 'should have a body' do
page.should have_css('body')
end
end
RUBY
end

__END__
Expand All @@ -12,6 +28,7 @@
author: mbleigh

requires: [rspec]
run_after: [rspec]
exclusive: acceptance_testing
category: testing
tags: [acceptance]
2 changes: 1 addition & 1 deletion spec/rails_wizard/template_spec.rb
Expand Up @@ -6,7 +6,7 @@

describe '#initialize' do
it 'should work with classes' do
subject.new([recipe]).should == recipe
subject.new([recipe]).recipes.should == [recipe]
end
end

Expand Down
13 changes: 12 additions & 1 deletion spec/support/template_runner.rb
@@ -1,4 +1,5 @@
class TemplateRunner
attr_reader :template, :config, :app_name, :dir, :rails_dir, :output
def initialize(template, config)
@template = template
@config = config
Expand All @@ -8,7 +9,17 @@ def run(app_name = 'rails_app')
@app_name = app_name
@dir = Dir.mktmpdir
@rails_dir = File.join(@dir, @app_name)

Dir.chrdir(@dir) do
template_file = File.open 'template.rb', 'w'
template_file.write
template_file.close
@output = `rails new #{@app_name} -m template.rb`
end
@output
end

def rails_directory
RailsDirectory.new(File.join(@dir, @app_name))
end

def clean
Expand Down
2 changes: 1 addition & 1 deletion templates/helpers.erb
Expand Up @@ -28,7 +28,7 @@ def multiple_choice(question, choices)
values = {}
choices.each_with_index do |choice,i|
values[(i + 1).to_s] = choice[1]
say_custom (i + 1).to_s + '.', choice[0]
say_custom (i + 1).to_s + ')', choice[0]
end
answer = ask_wizard("Enter your selection:") while !values.keys.include?(answer)
values[answer]
Expand Down
4 changes: 0 additions & 4 deletions test_run/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions test_run/Gemfile

This file was deleted.

0 comments on commit f23369c

Please sign in to comment.