Sha256: d14a4109d23025ba3a05760c163051205403f39859c2c425eb882cdfa6254c20
Contents?: true
Size: 987 Bytes
Versions: 8
Compression:
Stored size: 987 Bytes
Contents
require 'spec_helper' describe "Objects should be serialized to JSON" do it "should have json results" do expect(ActiveFedora::Base.new.to_json).to eq("{\"id\":null}") end describe "with a more interesting model" do before do class Foo < ActiveFedora::Base has_metadata 'descMetadata', type: ActiveFedora::SimpleDatastream do |m| m.field "foo", :text m.field "bar", :text end has_attributes :foo, datastream: 'descMetadata', multiple: true has_attributes :bar, datastream: 'descMetadata', multiple: false end end after do Object.send(:remove_const, :Foo) end subject { Foo.new(foo: ["baz"], bar: 'quix') } before { allow(subject).to receive_messages(pid: 'test:123') } it "should have to_json" do json = JSON.parse(subject.to_json) expect(json['id']).to eq "test:123" expect(json['foo']).to eq ["baz"] expect(json['bar']).to eq "quix" end end end
Version data entries
8 entries across 8 versions & 1 rubygems