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