Sha256: a8073663fb3840b91fa224b1a4137c8995897d2b30a1b1fcf157f6f684b5da82
Contents?: true
Size: 1.19 KB
Versions: 19
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe ActiveFedora::Scoping::Named do before do class TestClass < ActiveFedora::Base end end let!(:test_instance) { TestClass.create! } after do test_instance.delete Object.send(:remove_const, :TestClass) end describe "#all" do it "returns an array of instances of the calling Class" do result = TestClass.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 TestClass end end end describe '#find' do describe "#find with a valid id without cast" do subject { ActiveFedora::Base.find(test_instance.id) } it { is_expected.to be_instance_of TestClass } end describe "#find with a valid id with cast of false" do subject { ActiveFedora::Base.find(test_instance.id, cast: false) } it { is_expected.to be_instance_of ActiveFedora::Base } end describe "#find with a valid id without cast on a model extending Base" do subject { TestClass.find(test_instance.id) } it { is_expected.to be_instance_of TestClass } end end end
Version data entries
19 entries across 19 versions & 1 rubygems