Skip to content

Commit

Permalink
bump to version 3.1.3, update rubydora to 0.2.4. Ensure a mimeType is…
Browse files Browse the repository at this point in the history
… set for every datastream
  • Loading branch information
jcoyne committed Nov 18, 2011
1 parent 28169e9 commit 0434749
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 26 deletions.
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
active-fedora (3.1.2)
active-fedora (3.1.3)
activeresource (~> 3.0.0)
activesupport (~> 3.0.0)
equivalent-xml
Expand All @@ -13,7 +13,7 @@ PATH
om (>= 1.4.3)
rdf
rdf-rdfxml
rubydora (= 0.2.3)
rubydora (= 0.2.4)
solr-ruby (>= 0.0.6)
solrizer (> 1.0.0)
xml-simple (>= 1.0.12)
Expand All @@ -22,14 +22,14 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.8)
activemodel (3.0.10)
activesupport (= 3.0.10)
activemodel (3.0.11)
activesupport (= 3.0.11)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activeresource (3.0.10)
activemodel (= 3.0.10)
activesupport (= 3.0.10)
activesupport (3.0.10)
activeresource (3.0.11)
activemodel (= 3.0.11)
activesupport (= 3.0.11)
activesupport (3.0.11)
addressable (2.2.6)
akami (1.0.0)
gyoku (>= 0.4.0)
Expand Down Expand Up @@ -87,7 +87,7 @@ GEM
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
rubydora (0.2.3)
rubydora (0.2.4)
activemodel
activesupport
fastercsv
Expand Down
4 changes: 4 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
3.1.3
Set mimeType for all datastreams, default to text/xml
Update rubydora to 0.2.4

3.1.2
correctly handling non-default pid_namespace (Benjamin Armintor)
info uri support; rdf:type predicate compatibility with Fedora(Benjamin Armintor)
Expand Down
2 changes: 1 addition & 1 deletion active-fedora.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |s|
s.add_dependency("mediashelf-loggable")
s.add_dependency("equivalent-xml")
s.add_dependency("facets")
s.add_dependency("rubydora", '0.2.3')
s.add_dependency("rubydora", '0.2.4')
s.add_dependency("rdf")
s.add_dependency("rdf-rdfxml")
s.add_development_dependency("yard")
Expand Down
5 changes: 5 additions & 0 deletions lib/active_fedora/datastream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module ActiveFedora
class Datastream < Rubydora::Datastream

attr_accessor :dirty, :last_modified, :fields
before_create :add_mime_type

def initialize(digital_object, dsid)
@fields={}
Expand All @@ -15,6 +16,10 @@ def size
self.profile['dsSize']
end

def add_mime_type
self.mimeType = 'text/xml' unless self.mimeType
end

#compatibility method for rails' url generators. This method will
#urlescape escape dots, which are apparently
#invalid characters in a dsid.
Expand Down
6 changes: 0 additions & 6 deletions lib/active_fedora/nokogiri_datastream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ class NokogiriDatastream < Datastream

attr_accessor :internal_solr_doc

before_create :add_mime_type

def add_mime_type
self.mimeType= 'text/xml'
end

# Create an instance of this class based on xml content
# @param [String, File, Nokogiri::XML::Node] xml the xml content to build from
# @param [ActiveFedora::MetadataDatastream] tmpl the Datastream object that you are building @default a new instance of this class
Expand Down
2 changes: 0 additions & 2 deletions lib/active_fedora/rels_ext_datastream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class RelsExtDatastream < Datastream
include Solrizer::FieldNameMapper
attr_accessor :model

before_create :add_mime_type

def add_mime_type
self.mimeType= 'application/rdf+xml'
end
Expand Down
2 changes: 1 addition & 1 deletion lib/active_fedora/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ActiveFedora
VERSION = "3.1.2"
VERSION = "3.1.3"
end
2 changes: 1 addition & 1 deletion spec/unit/datastream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
describe '#save' do
it "should set dirty? to false" do
@mock_repo = mock('repository')
@mock_repo.stubs(:add_datastream).with(:versionable => true, :pid => @test_object.pid, :dsid => 'abcd', :controlGroup => 'M', :dsState => 'A', :content => 'hi there', :checksumType => 'DISABLED')
@mock_repo.stubs(:add_datastream).with(:mimeType=>'text/xml', :versionable => true, :pid => @test_object.pid, :dsid => 'abcd', :controlGroup => 'M', :dsState => 'A', :content => 'hi there', :checksumType => 'DISABLED')
@mock_repo.expects(:datastream).with(:dsid => 'abcd', :pid => @test_object.pid)
@test_object.inner_object.stubs(:repository).returns(@mock_repo)
@test_datastream.dirty?.should be_true
Expand Down
20 changes: 14 additions & 6 deletions spec/unit/metadata_datastream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
end

before(:each) do
mock_inner = mock('inner object')
@test_object = ActiveFedora::Base.new
@test_ds = ActiveFedora::MetadataDatastream.new(@test_object.inner_object, 'mdDs')
end

after(:each) do
@mock_repo = mock('repository')
@mock_repo.stubs(:datastream_dissemination=>'My Content')
mock_inner.stubs(:repository).returns(@mock_repo)
mock_inner.stubs(:pid)
@test_ds = ActiveFedora::MetadataDatastream.new(mock_inner, 'mdDs')
end

describe '#new' do
Expand All @@ -37,8 +39,14 @@
end

describe '.save' do
it "should provide .save" do
@test_ds.should respond_to(:save)
it "should persist the product of .to_xml in fedora" do
@test_ds.expects(:new?).returns(true).twice
@mock_repo.expects(:datastream).with(:pid => nil, :dsid => 'mdDs')
@mock_repo.expects(:add_datastream).with(:pid => nil, :dsid => 'mdDs', :checksumType => 'DISABLED', :versionable => true, :content => 'fake xml', :controlGroup => 'M', :dsState => 'A', :mimeType=>'text/xml')
@test_ds.expects(:to_xml).returns("fake xml")
@test_ds.serialize!
@test_ds.save
@test_ds.mimeType.should == 'text/xml'
end
end

Expand Down

0 comments on commit 0434749

Please sign in to comment.