Sha256: b3a135e479ee6211be346ccbc6ad0a0b87a1294ace47d1e67e48dca7da0c6037

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe GenericFile, :type => :model do
  before do
    subject.apply_depositor_metadata('jcoyne')
  end

  describe "terms_for_editing" do
    it "should return a list" do
      expect(subject.terms_for_editing).to eq([:resource_type, :title, :creator, :contributor, :description, :tag,
                    :rights, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url])
    end
  end
  describe "terms_for_display" do
    it "should return a list" do
      expect(subject.terms_for_display).to eq([:resource_type, :title,
        :creator, :contributor, :description, :tag, :rights, :publisher,
        :date_created, :subject, :language, :identifier, :based_near,
        :related_url])
    end
  end

  describe "accessible_attributes" do
    it "should have a list" do
      expect(subject.accessible_attributes).to include(:part_of, :resource_type, :title, :creator, :contributor, :description,
        :tag, :rights, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url, :permissions)
    end

    it "should sanitize them" do
      expect(subject.sanitize_attributes({'part_of' => 'A book', 'something_crazy' => "get's thrown out"})).to eq(
        {'part_of' => 'A book'}
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sufia-5.0.0 spec/models/generic_file/web_form_spec.rb
sufia-5.0.0.rc1 spec/models/generic_file/web_form_spec.rb
sufia-4.3.1 spec/models/generic_file/web_form_spec.rb
sufia-4.2.0 spec/models/generic_file/web_form_spec.rb
sufia-4.1.0 spec/models/generic_file/web_form_spec.rb