Sha256: e4be976d22e1be2dbc4957b0e9b3ecd62935ac185a5b5f05856c42e4ee726c3e
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper.rb' describe Populator::Record do it "should have a writer and reader methods for each column" do record = Populator::Record.new(Product, 1) Product.column_names.each do |column| record.send("#{column}=", "foo") record.send(column).should == "foo" end end it "should return attribute values in same order as columns" do record = Populator::Record.new(Product, nil) record.name = "foo" expected = Product.column_names.map { |c| "foo" if c == 'name' } record.attribute_values.should == expected end it "should assign second parameter to id" do Populator::Record.new(Product, 2).id.should == 2 end it "should pick random number from range" do record = Populator::Record.new(Product, 1) record.stock = 2..5 record.stock.should >= 2 record.stock.should <= 5 end it "should pick random value from array" do record = Populator::Record.new(Product, 1) record.name = %w[foo bar] %w[foo bar].should include(record.name) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ryanb-populator-0.1.0 | spec/populator/record_spec.rb |