Sha256: bc808ce4bcb10abe4b08143c3bcb9ee1603df545c4d950733d222ab1e1ca4d94

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'

describe Populator::ModelAdditions do
  it "should add populate method to active record class" do
    Product.should respond_to(:populate)
  end
  
  it "should add 10 records to database" do
    Product.delete_all
    Product.populate(10)
    Product.count.should == 10
  end
  
  it "should set attribute columns" do
    Product.populate(1) do |product|
      product.name = "foo"
    end
    Product.last.name.should == "foo"
  end
    
  it "should not pass in an instance of Active Record for performance reasons" do
    Product.populate(1) do |product|
      product.should_not be_kind_of(ActiveRecord::Base)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ryanb-populator-0.1.0 spec/populator/model_additions_spec.rb