RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

acts_as-fu is a gem that lets you build ...

acts_as-fu is a gem that lets you build ActiveRecord models on the fly for testing, or whatever other reason you may have: build_model :foos do string :name integer :age end If you’ve got an easier way to test-drive ActiveRecord extensions, do share!

Comments

How is this better than

class Foos < ActiveRecord::Base attr_accessor :name, :age end

or using something like machinist or shoulda?

Your snippet and both of those tools require you to have your ActiveRecord configuration setup in advance. Also, your snippet wouldn’t actually save the :name or :age attributes to the database.

With acts_as-fu, there’s no database.yml, no fixtures, or anything else like that. build_model handles everything. It’s also not tied to your test suite, so you can use it in an entirely different context, like so: gist.github.com/20015.

Ahh.. do you mean “testing” not as in TDD but general prototyping / playing around?

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in