Sha256: 57ce26e2a3c7da850b2b1e2f50268c8b1b0be1f1c41632550ecd1c22297cd789

Contents?: true

Size: 752 Bytes

Versions: 7

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'
require 'earth/automobile/automobile_make_year'

describe AutomobileMakeYear do
  let(:amy) { AutomobileMakeYear }
  
  describe 'Sanity check', :sanity => true do
    let(:total) { amy.count }
    
    it { total.should == 1276 }
    it { amy.where("fuel_efficiency > 0").count.should == total }
    it { amy.find("Honda 2011").fuel_efficiency.should be_within(1e-4).of(13.34186) }
    it { amy.find("Honda 2012").fuel_efficiency.should be_within(1e-5).of(12.17321) }
    
    it 'has proper weightings' do
      amy.connection.select_values("SELECT DISTINCT year FROM #{amy.quoted_table_name}").each do |year|
        amy.where(:year => year).first.weighting.should == AutomobileYear.weighting(year)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
earth-1.2.1 spec/earth/automobile/automobile_make_year_spec.rb
earth-1.1.2 spec/earth/automobile/automobile_make_year_spec.rb
earth-1.1.1 spec/earth/automobile/automobile_make_year_spec.rb
earth-1.1.0 spec/earth/automobile/automobile_make_year_spec.rb
earth-1.0.3 spec/earth/automobile/automobile_make_year_spec.rb
earth-1.0.2 spec/earth/automobile/automobile_make_year_spec.rb
earth-1.0.1 spec/earth/automobile/automobile_make_year_spec.rb