A smart gem with a dumb name; Dummier is a rails generator for automating the creation of rails testing applications.
The idea behind Dummier is that we don't check
test/dummy into git, but rather generate it on the fly for the gems we're developing. It just seems DRY'er that way.
Dummier is simple; just run the binary from your gem's root directory and it will generate a stripped-down & gem-dev-ready rails app in
test/dummy. While it's doing it's thing, Dummer triggers a few hooks along the way for easy customization.
To catch the hooks, just create appropriately named files in
test/dummy_hooks inside your gem. See Hooks below for more info.
To install from RubyGems:
gem install dummier
To install with bundler:
gem 'dummier', '>= 0.2.0'
To package for development in your gemspec:
s.add_development_dependency('dummier', '>= 0.2.0')
After you've installed Dummier, just
cd into the gem your developing and run the binary:
If you're in a gem that uses bundler, you may have to run the binary with
bundle exec dummier
Dummier calls the following hooks along the way:
before_delete before_app_generator after_app_generator before_migrate after_migrate
Place appropriately named files in
test/dummy_hooks and dummier will find and execute them automatically!
before_migrate.rb hook that will install Spree Commerce by running some rake commands before migrating the
# test/dummy_hooks/before_migrate.rb say_status "installing", "spree_core, spree_auth and spree_sample" rake "spree_core:install spree_auth:install spree_sample:install"
More Complex Example
Here's an example taken from has_magick_title:
# test/dummy_hooks/after_app_generator.rb run "rails g scaffold post title:string" gsub_file "app/models/post.rb", "end", %( has_magick_title end) gsub_file "config/routes.rb", "resources :posts", %( resources :posts root :to => "posts#index") gsub_file "app/views/posts/show.html.erb", "<%= @post.title %>", %( <%= magick_title_for @post %>)
To get setup for testing, clone this repo, bundle up and run rake.
git clone git://github.com/citrus/dummier.git cd dummier bundle install rake
0.2.0 - 2011/6/18
- moved the dummy_hooks to your test folder rather than in lib. makes more sense that way.
0.1.1 - 2011/6/1
- added your gem's
test/dummy_hooks/templatesfolder into the generator's
0.1.0 - 2011/5/20
- removed spork and wrote a basic hook test
- improved documentation
0.1.0.rc1 - 2011/5/11
- added spork and some tests
- it exists!
Copyright (c) 2011 Spencer Steffen and Citrus, released under the New BSD License All rights reserved.