mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-01 21:47:16 +00:00
- Add a script for downloading updated files. - Add a service for easier loading of vocab files.
27 lines
718 B
Ruby
27 lines
718 B
Ruby
# frozen_string_literal: true
|
|
|
|
require DfcProvider::Engine.root.join("spec/spec_helper")
|
|
|
|
describe DfcLoader do
|
|
it "prepares the DFC Connector to provide DFC object classes for export" do
|
|
connector = DfcLoader.connector
|
|
|
|
tomato = DataFoodConsortium::Connector::SuppliedProduct.new(
|
|
"https://openfoodnetwork.org/tomato",
|
|
name: "Tomato",
|
|
description: "Awesome tomato",
|
|
)
|
|
|
|
expect(tomato.name).to eq "Tomato"
|
|
expect(tomato.description).to eq "Awesome tomato"
|
|
|
|
json = connector.export(tomato)
|
|
result = JSON.parse(json)
|
|
|
|
expect(result.keys).to include(
|
|
*%w(@context @type dfc-b:name dfc-b:description)
|
|
)
|
|
expect(result["dfc-b:name"]).to eq "Tomato"
|
|
end
|
|
end
|