Sha256: 38ff6f1600761968337be7c2e658294f1b9362c28d22788a00a1c299b2f9e350

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe UsdaNutrientDatabase::Importer do
  let(:importer) { UsdaNutrientDatabase::Importer.new }

  describe '#import' do
    before do
      stub_request(:get, /.*/).
        to_return(body: File.read('spec/support/sr25.zip'))
      importer.import
    end

    it { expect(UsdaNutrientDatabase::FoodGroup.count).to eql(25) }
    it { expect(UsdaNutrientDatabase::Food.count).to eql(16) }
    it { expect(UsdaNutrientDatabase::Nutrient.count).to eql(15) }
    it { expect(UsdaNutrientDatabase::FoodsNutrient.count).to eql(12) }
    it { expect(UsdaNutrientDatabase::Weight.count).to eql(11) }
    it { expect(UsdaNutrientDatabase::Footnote.count).to eql(7) }

    context 'importing twice' do
      before { importer.import }

      it { expect(UsdaNutrientDatabase::FoodGroup.count).to eql(25) }
      it { expect(UsdaNutrientDatabase::Food.count).to eql(16) }
      it { expect(UsdaNutrientDatabase::Nutrient.count).to eql(15) }
      it { expect(UsdaNutrientDatabase::FoodsNutrient.count).to eql(12) }
      it { expect(UsdaNutrientDatabase::Weight.count).to eql(11) }
      it { expect(UsdaNutrientDatabase::Footnote.count).to eql(7) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
usda-nutrient-database-1.1.0 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-1.0.1 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-1.0.0 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-0.8.1 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-0.8.0 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-0.7.0 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-0.6.0 spec/lib/usda_nutrient_database/importer_spec.rb
usda-nutrient-database-0.5.0 spec/lib/usda_nutrient_database/importer_spec.rb