Skip to content

Commit

Permalink
Add Degree to ETD model and creation form
Browse files Browse the repository at this point in the history
  • Loading branch information
bess committed Apr 7, 2017
1 parent 51f7c9a commit be8af33
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/forms/hyrax/etd_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ class EtdForm < Hyrax::Forms::WorkForm
self.terms += [:resource_type]
self.terms += [:department]
self.terms += [:school]
self.terms += [:degree]
end
end
1 change: 1 addition & 0 deletions app/models/etd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ class Etd < ActiveFedora::Base
self.human_readable_type = 'Etd'
property :department, predicate: "https://schema.org/department"
property :school, predicate: "https://schema.org/alumniOf"
property :degree, predicate: "http://bibframe.org/vocab/dissertationDegree"
end
2 changes: 1 addition & 1 deletion spec/features/create_etd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
click_link("Additional fields")
fill_in "Department", with: "Department of Russian and East Asian Languages and Cultures"
fill_in "School", with: "Emory College of Arts and Sciences"
fill_in "Degree", with: "Bachelor of Arts with Honors"
select('All rights reserved', from: 'Rights')
choose('open')
check('agreement')
Expand All @@ -34,7 +35,6 @@
expect(page).to have_content 'Your files are being processed'
expect(page).to have_content 'deposited'
expect(page).to have_content 'China and its Minority Population'

end
end
end
1 change: 1 addition & 0 deletions spec/forms/hyrax/etd_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
its(:terms) { is_expected.to include(:title) }
its(:terms) { is_expected.to include(:department) }
its(:terms) { is_expected.to include(:school) }
its(:terms) { is_expected.to include(:degree) }
end
end
16 changes: 16 additions & 0 deletions spec/models/etd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
require 'rails_helper'

RSpec.describe Etd do
describe "#degree" do
subject { described_class.new }
let(:degree) { "Bachelor of Arts with Honors" }
context "with a new ETD" do
its(:degree) { is_expected.to be_empty }
end
context "with an existing ETD that has a degree defined" do
subject do
described_class.create.tap do |etd|
etd.degree = [degree]
end
end
its(:degree) { is_expected.to eq([degree]) }
end
end

describe "#department" do
subject { described_class.new }
context "with a new ETD" do
Expand Down

0 comments on commit be8af33

Please sign in to comment.