kandalf/summoner
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Summoner ======== Summoner is a really simple fixture replacemoent for Ruby. How to install -------------- gem install summoner You can _prepare_ your _monsters_ like: Summoner.prepare :monster do |c| c.type "Esper" end Then, you can _summon_ your _monsters_ like: Summoner.summon :monster Or, if you need to override default values: Summoner.summon :monster do |c| c.type "Guardian" end Also, you can override options with a hash: Summoner.summon(:monster, :type => "Avatar") v0.1.2 ====== From v0.1.2 on, you can also summon ActiveRecord instances directly from their classes without prepare them before, for example: Monster.summon do |m| m.type = "Esper" end Note the difference between with the _prepare_ method, here you should use the *=* sign to assign values. Rails ----- 1. Add config.gem "summoner" to the config/environments/test.rb or gem "summoner" to your Gemfile if you're using bundler 2. Define your _monsters_ on a file, e.g: spec/monsters.rb (you can call it as you please) 3. Require that file on your (test|spec)_helper.rb 4. Summon your _monsters_ on your tests/specs