Sha256: 6323af9135a06fde0777b39478783f97a6f6c2c23be639b7eae7fd219b884e71
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require 'spec_helper' describe ActiveFedora::Model do before do module ModelIntegrationSpec class Base < ActiveFedora::Base include ActiveFedora::Model end class Basic < Base end end end let!(:test_instance) { ModelIntegrationSpec::Basic.create! } after do test_instance.delete Object.send(:remove_const, :ModelIntegrationSpec) end describe "#all" do it "returns an array of instances of the calling Class" do result = ModelIntegrationSpec::Basic.all.to_a expect(result).to be_instance_of(Array) # this test is meaningless if the array length is zero expect(result).to_not be_empty result.each do |obj| expect(obj.class).to eq ModelIntegrationSpec::Basic end end end describe '#find' do describe "#find with a valid id without cast" do subject { ActiveFedora::Base.find(test_instance.id) } it { should be_instance_of ModelIntegrationSpec::Basic } end describe "#find with a valid id with cast of false" do subject { ActiveFedora::Base.find(test_instance.id, cast: false) } it { should be_instance_of ActiveFedora::Base } end describe "#find with a valid id without cast on a model extending Base" do subject { ModelIntegrationSpec::Basic.find(test_instance.id) } it { should be_instance_of ModelIntegrationSpec::Basic } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active-fedora-9.13.0 | spec/integration/model_spec.rb |