Sha256: 8fb812f1e6a7d356a5f72fd2fe312079e01f67b48d38084988d425da2c92bc05
Contents?: true
Size: 1.61 KB
Versions: 10
Compression:
Stored size: 1.61 KB
Contents
require 'earth/fuel' # Not yet in use - for if we want to autocaculate size class stuf - November 10, 2011 class AutomobileSizeClassYear < ActiveRecord::Base self.primary_key = "name" col :name col :size_class_name col :year, :type => :integer col :type_name col :fuel_efficiency_city, :type => :float col :fuel_efficiency_city_units col :fuel_efficiency_highway, :type => :float col :fuel_efficiency_highway_units # verify "Year should be from 1975 to 2010" do # AutomobileSizeClassYear.all.each do |record| # unless record.year > 1974 and record.year < 2011 # raise "Invalid year for AutomobileSizeClassYear #{record.name}: #{record.year} (should be from 1975 to 2010)" # end # end # end # # verify "Fuel efficiencies should be greater than zero" do # AutomobileSizeClassYear.all.each do |year| # %w{ fuel_efficiency_city fuel_efficiency_highway }.each do |attribute| # value = year.send(:"#{attribute}") # unless value > 0 # raise "Invalid #{attribute} for AutomobileSizeClassYear #{year.name}: #{value} (should be > 0)" # end # end # end # end # # verify "Fuel efficiency units should be kilometres per litre" do # AutomobileSizeClassYear.all.each do |year| # %w{ fuel_efficiency_city_units fuel_efficiency_highway_units }.each do |attribute| # value = year.send(:"#{attribute}") # unless value == "kilometres_per_litre" # raise "Invalid #{attribute} for AutomobileSizeClassYear #{year.name}: #{value} (should be kilometres_per_litre)" # end # end # end # end end
Version data entries
10 entries across 10 versions & 1 rubygems