Sha256: 9eef9a771e25d8ed21eae690bf7f3b82ce14ecf95dfc7f054dfa67e3e9ad2c9e
Contents?: true
Size: 1.15 KB
Versions: 5
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' module Ddr module Models RSpec.describe HasStructMetadata, type: :model do context "component" do describe "component creation" do let(:item) { Item.new } let(:comp) { Component.new(identifier: [ "id001" ]) } before do allow(comp).to receive(:parent).and_return(item) allow(comp).to receive(:has_content?).and_return(true) allow(comp).to receive(:content_type).and_return("image/tiff") allow(item).to receive(:children_by_file_use).and_return({}) end it "should assign default values for unassigned attributes" do comp.save expect(comp.file_use).to_not be_nil expect(comp.order).to_not be_nil expect(comp.file_group).to_not be_nil end it "should not overwrite assigned attributes" do comp.update_attributes(file_use: 'foo', order: 3, file_group: 'special') expect(comp.file_use).to eq('foo') expect(comp.order).to eq(3) expect(comp.file_group).to eq('special') end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems