Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
temp commit
Browse files Browse the repository at this point in the history
do not base work off of this.
  • Loading branch information
JPrevost committed Nov 17, 2015
1 parent 64c216a commit 1d8c45f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -7,6 +7,7 @@ gem 'devise'
gem 'http_logger'
gem 'jquery-rails'
gem 'less-rails'
gem 'nokogiri'
gem 'omniauth-mit-oauth2'
gem 'omniauth-oauth2', '~> 1.3.1'
gem 'passenger'
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Expand Up @@ -262,6 +262,7 @@ DEPENDENCIES
minitest-rails
minitest-rails-capybara
minitest-reporters
nokogiri
omniauth-mit-oauth2
omniauth-oauth2 (~> 1.3.1)
passenger
Expand Down
4 changes: 4 additions & 0 deletions app/models/submission.rb
Expand Up @@ -20,4 +20,8 @@ class Submission < ActiveRecord::Base
validates :user, presence: true
validates :title, presence: true
validates :agreed_to_license, inclusion: { in: [true] }

def mets
self.to_xml
end
end
8 changes: 8 additions & 0 deletions test/models/submission_test.rb
Expand Up @@ -40,4 +40,12 @@ class SubmissionTest < ActiveSupport::TestCase
sub.agreed_to_license = false
assert_not sub.valid?
end

test '#mets' do
dtd = Net::HTTP.get(URI("http://www.loc.gov/standards/mets/version111/mets.xsd"))
sub = submissions(:sub_one)
xsd = Nokogiri::XML::Schema(dtd)
doc = Nokogiri::XML(sub.mets)
assert_equal(true, xsd.valid?(doc))
end
end

0 comments on commit 1d8c45f

Please sign in to comment.