hydra-file-access 5.1.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-file-access
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-20 00:00:00.000000000 Z
13
+ date: 2013-01-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -163,7 +163,7 @@ dependencies:
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 5.1.0
166
+ version: 5.3.0
167
167
  type: :runtime
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
@@ -171,7 +171,7 @@ dependencies:
171
171
  requirements:
172
172
  - - '='
173
173
  - !ruby/object:Gem::Version
174
- version: 5.1.0
174
+ version: 5.3.0
175
175
  - !ruby/object:Gem::Dependency
176
176
  name: sqlite3
177
177
  requirement: !ruby/object:Gem::Requirement
@@ -372,7 +372,6 @@ files:
372
372
  - app/helpers/hydra/application_helper_behavior.rb
373
373
  - app/helpers/hydra/hydra_helper_behavior.rb
374
374
  - app/helpers/hydra_helper.rb
375
- - app/models/file_asset.rb
376
375
  - app/models/uses_default_partials.rb
377
376
  - app/views/_add_assets_links.html.erb
378
377
  - app/views/_user_util_links.html.erb
@@ -438,12 +437,10 @@ files:
438
437
  - spec/controllers/file_assets_controller_spec.rb
439
438
  - spec/fixtures/small_file.txt
440
439
  - spec/helpers/assets_controller_helper_spec.rb
441
- - spec/helpers/file_assets_helper_spec.rb
442
440
  - spec/helpers/hydra_helper_spec.rb
443
441
  - spec/helpers/hydra_model_methods_spec.rb
444
442
  - spec/integration/file_asset_spec.rb
445
443
  - spec/lib/hydra_submission_workflow_spec.rb
446
- - spec/models/file_asset_spec.rb
447
444
  - spec/spec_helper.rb
448
445
  - spec/support/Gemfile
449
446
  - spec/support/app/models/generic_content.rb
@@ -480,6 +477,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
480
477
  - - ! '>='
481
478
  - !ruby/object:Gem::Version
482
479
  version: '0'
480
+ segments:
481
+ - 0
482
+ hash: 3796402485335238874
483
483
  requirements: []
484
484
  rubyforge_project:
485
485
  rubygems_version: 1.8.24
@@ -491,12 +491,10 @@ test_files:
491
491
  - spec/controllers/file_assets_controller_spec.rb
492
492
  - spec/fixtures/small_file.txt
493
493
  - spec/helpers/assets_controller_helper_spec.rb
494
- - spec/helpers/file_assets_helper_spec.rb
495
494
  - spec/helpers/hydra_helper_spec.rb
496
495
  - spec/helpers/hydra_model_methods_spec.rb
497
496
  - spec/integration/file_asset_spec.rb
498
497
  - spec/lib/hydra_submission_workflow_spec.rb
499
- - spec/models/file_asset_spec.rb
500
498
  - spec/spec_helper.rb
501
499
  - spec/support/Gemfile
502
500
  - spec/support/app/models/generic_content.rb
@@ -1,5 +0,0 @@
1
- # model for a FileAsset ActiveFedora object
2
- # a file asset is a generic notion of a file, which could have, for example, image or text or video behaviors.
3
- class FileAsset < ActiveFedora::Base
4
- include Hydra::Models::FileAsset
5
- end
@@ -1,116 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hydra::Controller::UploadBehavior do
4
-
5
- it "should respond to datastream_id" do
6
- helper.should respond_to :datastream_id ### API method, test that it's there to be overridden
7
- end
8
-
9
- describe "create_and_save_file_asset_from_params" do
10
- it "should create the file asset, add posted blob to it and save the file asset" do
11
- mock_fa = mock("file asset")
12
- helper.stub(:params).and_return( { :Filedata => [mock_fa] } )
13
- mock_fa.should_receive(:save)
14
- helper.should_receive(:create_asset_from_file).and_return(mock_fa)
15
- helper.should_receive(:add_posted_blob_to_asset)
16
- helper.create_and_save_file_assets_from_params
17
- end
18
- end
19
-
20
- describe "add_posted_blob_to_asset" do
21
- it "should set object title and label, relying on datastream_id to set dsId" do
22
- mock_file = mock("File")
23
- file_name = "Posted Filename.foo"
24
- helper.stub(:params).and_return( :Filedata=>[mock_file], :Filename=>file_name, "container_id"=>"hydrangea:2973" )
25
- mock_fa = mock("file asset")
26
- mock_file.should_receive(:original_filename).and_return(file_name)
27
- helper.stub(:datastream_id).and_return('bar')
28
- mock_fa.should_receive(:add_file_datastream).with(mock_file, :label=>file_name, :mimeType=>"mymimetype", :dsid=>'bar')
29
- mock_fa.should_receive(:set_title_and_label).with( file_name, :only_if_blank=>true )
30
- helper.should_receive(:mime_type).with(file_name).and_return("mymimetype")
31
- helper.add_posted_blob_to_asset(mock_fa,mock_file)
32
- end
33
-
34
- it "should support submissions from swfupload" do
35
- mock_file = mock("File")
36
- file_name = "Posted Filename.foo"
37
- helper.stub(:params).and_return( :Filedata=>[mock_file], :Filename=>file_name, "container_id"=>"hydrangea:2973" )
38
- mock_fa = mock("file asset")
39
- mock_file.should_receive(:original_filename).and_return(file_name)
40
- mock_fa.should_receive(:add_file_datastream).with(mock_file, :label=>file_name, :mimeType=>"mymimetype", :dsid => 'content')
41
- mock_fa.stub(:set_title_and_label)
42
- helper.should_receive(:mime_type).with(file_name).and_return("mymimetype")
43
- helper.add_posted_blob_to_asset(mock_fa,mock_file)
44
- end
45
- it "should support submissions from single-file uploader, defaulting to dsId of content" do
46
- mock_file = mock("File")
47
- file_name = "Posted Filename.foo"
48
- # helper.should_receive(:filename_from_params).and_return(file_name)
49
- helper.stub(:params).and_return( :Filedata=>[mock_file], :container_id=>"hydrangea:2973" )
50
- mock_file.should_receive(:original_filename).and_return(file_name)
51
- mock_fa = mock("file asset")
52
- helper.should_receive(:mime_type).with(file_name).and_return("mymimetype")
53
- mock_fa.should_receive(:add_file_datastream).with(mock_file, :label=>file_name, :mimeType=>"mymimetype", :dsid => 'content')
54
- mock_fa.stub(:set_title_and_label)
55
- helper.add_posted_blob_to_asset(mock_fa,mock_file)
56
- end
57
- end
58
-
59
- describe "create_asset_from_params" do
60
- it "should create a new file asset and set the label from params[:Filename]" do
61
- helper.stub(:params).and_return( { :Filename => "Test Filename" } )
62
- result = helper.create_asset_from_params
63
- result.should be_kind_of FileAsset
64
- result.label.should == "Test Filename"
65
- end
66
- it "should choose model by filename" do
67
- pending "this is currently disabled"
68
- helper.should_receive(:choose_model_by_filename)
69
- helper.create_asset_from_params
70
- end
71
- end
72
-
73
- describe "posted_file" do
74
- it "should return the posted file" do
75
- helper.should_receive(:params).and_return(:Filedata=>"test posted file")
76
- helper.posted_file.should == "test posted file"
77
- end
78
- it "should return nil if no file was posted" do
79
- helper.posted_file.should == nil
80
- end
81
- end
82
-
83
- describe "filename_from_params" do
84
- it "should return the value of params[:Filename] if it was submitted" do
85
- helper.stub(:params).and_return(:Filename => "Test Filename")
86
- helper.filename_from_params.should == "Test Filename"
87
- end
88
- it "should default to using the original filename of the posted file" do
89
- helper.stub(:params).and_return({})
90
- helper.should_receive(:posted_file).and_return(mock("File", :original_filename=>"Test Original Filename"))
91
- helper.filename_from_params.should == "Test Original Filename"
92
- end
93
- end
94
-
95
- describe "choose_model_by_filename" do
96
- it "should return model classes based on filename extensions" do
97
- pending "This can only be enabled if/when we adopt replacements for ImageAsset, AudioAsset, etc. as default primitives."
98
-
99
- ["filename.wav","filename.mp3","filename.aiff"].each do |fn|
100
- helper.choose_model_by_filename(fn).should == AudioAsset
101
- end
102
-
103
- ["filename.mov","filename.flv","filename.mp4", "filename.m4v"].each do |fn|
104
- helper.choose_model_by_filename(fn).should == VideoAsset
105
- end
106
-
107
- ["filename.jpeg","filename.jpg","filename.gif", "filename.png"].each do |fn|
108
- helper.choose_model_by_filename(fn).should == ImageAsset
109
- end
110
-
111
- ["filename.doc","filename.pdf","filename.jp2", "filename.zip"].each do |fn|
112
- helper.choose_model_by_filename(fn).should == FileAsset
113
- end
114
- end
115
- end
116
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FileAsset do
4
-
5
- before(:each) do
6
- @file_asset = FileAsset.new
7
- @file_asset.stub(:create_date).and_return("2008-07-02T05:09:42.015Z")
8
- @file_asset.stub(:modified_date).and_return("2008-09-29T21:21:52.892Z")
9
- end
10
-
11
- it "Should be a kind of ActiveFedora::Base" do
12
- @file_asset.should be_kind_of(ActiveFedora::Base)
13
- end
14
-
15
- it "should include Hydra Model Methods" do
16
- @file_asset.class.included_modules.should include(Hydra::ModelMethods)
17
- @file_asset.should respond_to(:apply_depositor_metadata)
18
- end
19
-
20
- describe 'label' do
21
- asset = FileAsset.new
22
- asset.label = 'image.jp2'
23
- asset.label.should == 'image.jp2'
24
- end
25
- end