mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
22 lines
624 B
Ruby
22 lines
624 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe ConnectedApp do
|
|
it { is_expected.to belong_to :enterprise }
|
|
|
|
it "stores data as json hash" do
|
|
# This functionality is just Rails and would usually not warrant a spec but
|
|
# it's the first time we use the json datatype in this codebase and
|
|
# therefore it's a nice example to see how it works.
|
|
expect(subject.data).to eq nil
|
|
|
|
subject.enterprise = create(:enterprise)
|
|
subject.data = { link: "https://example.net" }
|
|
subject.save!
|
|
subject.reload
|
|
|
|
expect(subject.data).to eq({ "link" => "https://example.net" })
|
|
end
|
|
end
|