Sha256: f6c2195ac5ba7ebf014de9adebec03f9dc5a61cc38867d17b718e0e4ae508797
Contents?: true
Size: 945 Bytes
Versions: 12
Compression:
Stored size: 945 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 it "should not pass options hash" do $queries_executed = [] Product.populate(5, :per_query => 2) do |product| product.should_not be_kind_of(ActiveRecord::Base) end $queries_executed.grep(/^insert/i).should have(3).records end end
Version data entries
12 entries across 12 versions & 4 rubygems