<commit_before>h1. ACTS_AS-FU

Now you have no excuse for not test-driving your ActiveRecord
extending plugins.

h3. Usage

In your spec_helper.rb (pretty sure this works with Test::Unit
too, I'll leave you to figure it out though)

  require 'rubygems'
  require 'acts_as_fu'
  require 'spec'
  
  Spec::Runner.configure do |config|
    config.include ActsAsFu
  end

Then in your specs:

  describe "acts_as_gilmore_girls" do
    before(:each) do
      build_model :nerds do
        text :omg_omg_bio
        string :name
        string :favorite_scene
        
        def awesome?(show_name)
          show_name == "<NAME>"
        end
      end
    end
    
    it "should require favorite scene" do
      nerd = Nerd.new :favorite_scene => nil
      nerd.should_not be_valid
      nerd.errors.on(:favorite_scene).should_not be_nil
    end
    
    it "should think gilmore girls is awesome"
      nerd = Nerd.new
      nerd.awesome?("<NAME>").should be_true
    end
    
    it "has other stuff" do
      # ETC!
    end
  end
  
The @build_model@ method allows you to build an ActiveRecord on
the fly. It takes a block where you can specify columns and methods.
The table will be created in in an in-memory sqlite3 database. If
you need another adapter, this project ain't for you. Sorry.

h4. Single Table Inheritance

If you want to create a model that's a subclass of another, you can
use the @:superclass@ option:

  build_model(:assets) do
    string :type
    string :name
  
    named_scope :pictures, :conditions => { :type => "Picture" }
  end

  build_model(:pictures, :superclass => Asset)

The @Picture@ model will then be a subclass of the @Asset@ model.

TODO

* Maybe a couple more options... maybe.

NOTE
<commit_msg>fixed readme formatting issues<commit_after>h1. ACTS_AS-FU

Now you have no excuse for not test-driving your ActiveRecord
extending plugins.

h3. Usage

In your spec_helper.rb (pretty sure this works with Test::Unit
too, I'll leave you to figure it out though)

  require 'rubygems'
  require 'acts_as_fu'
  require 'spec'
  
  Spec::Runner.configure do |config|
    config.include ActsAsFu
  end

Then in your specs:

  describe "acts_as_gilmore_girls" do
    before(:each) do
      build_model :nerds do
        text :omg_omg_bio
        string :name
        string :favorite_scene
        def awesome?(show_name)
          show_name == "<NAME>"
        end
      end
    end
    
    it "should require favorite scene" do
      nerd = Nerd.new :favorite_scene => nil
      nerd.should_not be_valid
      nerd.errors.on(:favorite_scene).should_not be_nil
    end
    
    it "should think gilmore girls is awesome"
      nerd = Nerd.new
      nerd.awesome?("<NAME>").should be_true
    end
    
    it "has other stuff" do
      # ETC!
    end
  end
  
The @build_model@ method allows you to build an ActiveRecord on
the fly. It takes a block where you can specify columns and methods.
The table will be created in in an in-memory sqlite3 database. If
you need another adapter, this project ain't for you. Sorry.

h4. Single Table Inheritance

If you want to create a model that's a subclass of another, you can
use the @:superclass@ option:

  build_model(:assets) do
    string :type
    string :name
    named_scope :pictures, :conditions => { :type => "Picture" }
  end

  build_model(:pictures, :superclass => Asset)

The @Picture@ model will then be a subclass of the @Asset@ model.

TODO

* Maybe a couple more options... maybe.

NOTE

{'fraction_non_alphanumeric': 0.07349985644559288, 'fraction_numerical': 0.0022968705139247776, 'mean_word_length': 2.8201754385964914, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1248594', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1086, 'n_words': 419}