Sha256: 18a42c9eff8af0514adec08798cb77e088be2f86a57a7e198ef93a0e5b9f7c30

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

require 'spec_helper'

describe Sufia::Forms::GenericFileEditForm do
  subject { described_class.new(GenericFile.new) }

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

  it "should initialize multivalued fields" do
    expect(subject.title).to eq ['']
  end

  describe ".model_attributes" do
    let(:params) { ActionController::Parameters.new(title: ['foo'], description: [''])}
    subject { described_class.model_attributes(params) }

    it "should only change title" do
      expect(subject['title']).to eq ["foo"]
      expect(subject['description']).to be_empty
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sufia-6.0.0.rc2 spec/forms/generic_file_edit_form_spec.rb
sufia-6.0.0.rc1 spec/forms/generic_file_edit_form_spec.rb