active-fedora 4.0.0.rc8 → 4.0.0.rc9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/History.txt +3 -2
- data/lib/active_fedora.rb +25 -207
- data/lib/active_fedora/config.rb +4 -6
- data/lib/active_fedora/datastream.rb +0 -4
- data/lib/active_fedora/file_configurator.rb +217 -0
- data/lib/active_fedora/predicates.rb +2 -2
- data/lib/active_fedora/rdf_datastream.rb +11 -6
- data/lib/active_fedora/solr_service.rb +5 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/config_helper.rb +26 -0
- data/spec/integration/ntriples_datastream_spec.rb +52 -0
- data/spec/spec_helper.rb +4 -1
- data/spec/unit/active_fedora_spec.rb +5 -308
- data/spec/unit/code_configurator_spec.rb +51 -0
- data/spec/unit/config_spec.rb +4 -4
- data/spec/unit/file_configurator_spec.rb +273 -0
- data/spec/unit/solr_service_spec.rb +0 -1
- metadata +11 -6
- data/spec/unit/datastream_concurrency_spec.rb +0 -59
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'config_helper'
|
3
|
+
|
4
|
+
describe ActiveFedora::FileConfigurator do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
class TestConfigurator
|
8
|
+
attr_reader :fedora_config, :solr_config, :predicate_config
|
9
|
+
|
10
|
+
def init(options = {})
|
11
|
+
@fedora_config = options[:fedora_config]
|
12
|
+
@solr_config = options[:solr_config]
|
13
|
+
@predicate_config = options[:predicate_config]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
@config_params = {
|
18
|
+
:fedora_config => { :url => 'http://codeconfig.example.edu/fedora/', :user => 'fedoraAdmin', :password => 'configurator', :cert_file => '/path/to/cert/file' },
|
19
|
+
:solr_config => { :url => 'http://codeconfig.example.edu/solr/' },
|
20
|
+
:predicate_config => {
|
21
|
+
:default_namespace => 'info:fedora/fedora-system:def/relations-external#',
|
22
|
+
:predicate_mapping => {
|
23
|
+
'info:fedora/fedora-system:def/relations-external#' => { :has_part => 'hasPart' }
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
before :each do
|
30
|
+
ActiveFedora.configurator = TestConfigurator.new
|
31
|
+
end
|
32
|
+
|
33
|
+
after :all do
|
34
|
+
unstub_rails
|
35
|
+
# Restore to default fedora configs
|
36
|
+
ActiveFedora.configurator = ActiveFedora::FileConfigurator.new
|
37
|
+
restore_spec_configuration
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should initialize from code" do
|
41
|
+
YAML.expects(:load).never
|
42
|
+
File.expects(:exists?).never
|
43
|
+
File.expects(:read).never
|
44
|
+
File.expects(:open).never
|
45
|
+
ActiveFedora.init(@config_params)
|
46
|
+
ActiveFedora.fedora_config.credentials.should == @config_params[:fedora_config]
|
47
|
+
ActiveFedora.solr_config.should == @config_params[:solr_config]
|
48
|
+
ActiveFedora::Predicates.predicate_mappings['info:fedora/fedora-system:def/relations-external#'].length.should == 1
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/spec/unit/config_spec.rb
CHANGED
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActiveFedora::Config do
|
4
4
|
describe "with a single fedora instance" do
|
5
|
-
|
6
|
-
|
5
|
+
conf = YAML.load(File.read('spec/fixtures/rails_root/config/fedora.yml'))['test']
|
6
|
+
subject { ActiveFedora::Config.new(conf) }
|
7
7
|
its(:credentials) { should == {:url => 'http://testhost.com:8983/fedora', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'}}
|
8
8
|
it { should_not be_sharded }
|
9
9
|
end
|
10
10
|
describe "with several fedora shards" do
|
11
|
-
|
12
|
-
|
11
|
+
conf = YAML.load(File.read('spec/fixtures/sharded_fedora.yml'))['test']
|
12
|
+
subject { ActiveFedora::Config.new(conf) }
|
13
13
|
its(:credentials) { should == [{:url => 'http://127.0.0.1:8983/fedora1', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'},
|
14
14
|
{:url => 'http://127.0.0.1:8983/fedora2', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'},
|
15
15
|
{:url => 'http://127.0.0.1:8983/fedora3', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'}]}
|
@@ -0,0 +1,273 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'config_helper'
|
3
|
+
|
4
|
+
describe ActiveFedora::FileConfigurator do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
@configurator = ActiveFedora.configurator
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
unstub_rails
|
12
|
+
# Restore to default fedora configs
|
13
|
+
restore_spec_configuration
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "initialization methods" do
|
17
|
+
|
18
|
+
describe "get_config_path(:fedora)" do
|
19
|
+
it "should use the config_options[:config_path] if it exists" do
|
20
|
+
@configurator.expects(:config_options).at_least_once.returns({:fedora_config_path => "/path/to/fedora.yml"})
|
21
|
+
File.expects(:file?).with("/path/to/fedora.yml").returns(true)
|
22
|
+
@configurator.get_config_path(:fedora).should eql("/path/to/fedora.yml")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should look in Rails.root/config/fedora.yml if it exists and no fedora_config_path passed in" do
|
26
|
+
@configurator.expects(:config_options).at_least_once.returns({})
|
27
|
+
stub_rails(:root => "/rails/root")
|
28
|
+
File.expects(:file?).with("/rails/root/config/fedora.yml").returns(true)
|
29
|
+
@configurator.get_config_path(:fedora).should eql("/rails/root/config/fedora.yml")
|
30
|
+
unstub_rails
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should look in ./config/fedora.yml if neither rails.root nor :fedora_config_path are set" do
|
34
|
+
@configurator.expects(:config_options).at_least_once.returns({})
|
35
|
+
Dir.expects(:getwd).at_least_once.returns("/current/working/directory")
|
36
|
+
File.expects(:file?).with("/current/working/directory/config/fedora.yml").returns(true)
|
37
|
+
@configurator.get_config_path(:fedora).should eql("/current/working/directory/config/fedora.yml")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return default fedora.yml that ships with active-fedora if none of the above" do
|
41
|
+
@configurator.expects(:config_options).at_least_once.returns({})
|
42
|
+
Dir.expects(:getwd).at_least_once.returns("/current/working/directory")
|
43
|
+
File.expects(:file?).with("/current/working/directory/config/fedora.yml").returns(false)
|
44
|
+
File.expects(:file?).with(File.expand_path(File.join(File.dirname("__FILE__"),'config','fedora.yml'))).returns(true)
|
45
|
+
logger.expects(:warn).with("Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml to ActiveFedora - ie. ActiveFedora.init(:fedora_config_path => '/path/to/fedora.yml') - or set Rails.root and put fedora.yml into \#{Rails.root}/config.")
|
46
|
+
@configurator.get_config_path(:fedora).should eql(File.expand_path(File.join(File.dirname("__FILE__"),'config','fedora.yml')))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "get_config_path(:solr)" do
|
51
|
+
it "should return the solr_config_path if set in config_options hash" do
|
52
|
+
@configurator.expects(:config_options).at_least_once.returns({:solr_config_path => "/path/to/solr.yml"})
|
53
|
+
File.expects(:file?).with("/path/to/solr.yml").returns(true)
|
54
|
+
@configurator.get_config_path(:solr).should eql("/path/to/solr.yml")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return the solr.yml file in the same directory as the fedora.yml if it exists" do
|
58
|
+
@configurator.expects(:path).returns("/path/to/fedora/config/fedora.yml")
|
59
|
+
File.expects(:file?).with("/path/to/fedora/config/solr.yml").returns(true)
|
60
|
+
@configurator.get_config_path(:solr).should eql("/path/to/fedora/config/solr.yml")
|
61
|
+
end
|
62
|
+
|
63
|
+
context "no solr.yml in same directory as fedora.yml and fedora.yml does not contain solr url" do
|
64
|
+
|
65
|
+
before :each do
|
66
|
+
@configurator.expects(:config_options).at_least_once.returns({})
|
67
|
+
@configurator.expects(:path).returns("/path/to/fedora/config/fedora.yml")
|
68
|
+
File.expects(:file?).with("/path/to/fedora/config/solr.yml").returns(false)
|
69
|
+
end
|
70
|
+
after :each do
|
71
|
+
unstub_rails
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should not raise an error if there is not a solr.yml in the same directory as the fedora.yml and the fedora.yml has a solr url defined and look in rails.root" do
|
75
|
+
stub_rails(:root=>"/rails/root")
|
76
|
+
File.expects(:file?).with("/rails/root/config/solr.yml").returns(true)
|
77
|
+
@configurator.get_config_path(:solr).should eql("/rails/root/config/solr.yml")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should look in ./config/solr.yml if no rails root" do
|
81
|
+
Dir.expects(:getwd).at_least_once.returns("/current/working/directory")
|
82
|
+
File.expects(:file?).with("/current/working/directory/config/solr.yml").returns(true)
|
83
|
+
@configurator.get_config_path(:solr).should eql("/current/working/directory/config/solr.yml")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should return the default solr.yml file that ships with active-fedora if no other option is set" do
|
87
|
+
Dir.expects(:getwd).at_least_once.returns("/current/working/directory")
|
88
|
+
File.expects(:file?).with("/current/working/directory/config/solr.yml").returns(false)
|
89
|
+
File.expects(:file?).with(File.expand_path(File.join(File.dirname("__FILE__"),'config','solr.yml'))).returns(true)
|
90
|
+
logger.expects(:warn).with("Using the default solr.yml that comes with active-fedora. If you want to override this, pass the path to solr.yml to ActiveFedora - ie. ActiveFedora.init(:solr_config_path => '/path/to/solr.yml') - or set Rails.root and put solr.yml into \#{Rails.root}/config.")
|
91
|
+
@configurator.get_config_path(:solr).should eql(File.expand_path(File.join(File.dirname("__FILE__"),'config','solr.yml')))
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#determine url" do
|
98
|
+
it "should support config['environment']['url'] if config_type is fedora" do
|
99
|
+
config = {:test=> {:url=>"http://fedoraAdmin:fedorAdmin@localhost:8983/fedora"}}
|
100
|
+
@configurator.determine_url("fedora",config).should eql("http://localhost:8983/fedora")
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should call #get_solr_url to determine the solr url if config_type is solr" do
|
104
|
+
config = {:test=>{:default => "http://default.solr:8983"}}
|
105
|
+
@configurator.expects(:get_solr_url).with(config[:test]).returns("http://default.solr:8983")
|
106
|
+
@configurator.determine_url("solr",config).should eql("http://default.solr:8983")
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "load_config" do
|
111
|
+
it "should load the file specified in solr_config_path" do
|
112
|
+
@configurator.expects(:solr_config_path).returns("/path/to/solr.yml")
|
113
|
+
File.expects(:open).with("/path/to/solr.yml").returns("development:\n default:\n url: http://devsolr:8983\ntest:\n default:\n url: http://mysolr:8080")
|
114
|
+
@configurator.load_config(:solr).should eql({:url=>"http://mysolr:8080",:development=>{"default"=>{"url"=>"http://devsolr:8983"}}, :test=>{:default=>{"url"=>"http://mysolr:8080"}}})
|
115
|
+
@configurator.solr_config.should eql({:url=>"http://mysolr:8080",:development=>{"default"=>{"url"=>"http://devsolr:8983"}}, :test=>{:default=>{"url"=>"http://mysolr:8080"}}})
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "load_configs" do
|
120
|
+
describe "when config is not loaded" do
|
121
|
+
before do
|
122
|
+
@configurator.instance_variable_set :@config_loaded, nil
|
123
|
+
end
|
124
|
+
it "should load the fedora and solr configs" do
|
125
|
+
#ActiveFedora.expects(:load_config).with(:fedora)
|
126
|
+
@configurator.expects(:load_config).with(:solr)
|
127
|
+
@configurator.config_loaded?.should be_false
|
128
|
+
@configurator.load_configs
|
129
|
+
@configurator.config_loaded?.should be_true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
describe "when config is loaded" do
|
133
|
+
before do
|
134
|
+
@configurator.instance_variable_set :@config_loaded, true
|
135
|
+
end
|
136
|
+
it "should load the fedora and solr configs" do
|
137
|
+
@configurator.expects(:load_config).never
|
138
|
+
@configurator.config_loaded?.should be_true
|
139
|
+
@configurator.load_configs
|
140
|
+
@configurator.config_loaded?.should be_true
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "check_fedora_path_for_solr" do
|
146
|
+
it "should find the solr.yml file and return it if it exists" do
|
147
|
+
@configurator.expects(:path).returns("/path/to/fedora/fedora.yml")
|
148
|
+
File.expects(:file?).with("/path/to/fedora/solr.yml").returns(true)
|
149
|
+
@configurator.check_fedora_path_for_solr.should == "/path/to/fedora/solr.yml"
|
150
|
+
end
|
151
|
+
it "should return nil if the solr.yml file is not there" do
|
152
|
+
@configurator.expects(:path).returns("/path/to/fedora/fedora.yml")
|
153
|
+
File.expects(:file?).with("/path/to/fedora/solr.yml").returns(false)
|
154
|
+
@configurator.check_fedora_path_for_solr.should be_nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "setting the environment and loading configuration" do
|
160
|
+
|
161
|
+
before(:all) do
|
162
|
+
@fake_rails_root = File.expand_path(File.dirname(__FILE__) + '/../fixtures/rails_root')
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
after(:all) do
|
167
|
+
config_file = File.join(File.dirname(__FILE__), "..", "..", "config", "fedora.yml")
|
168
|
+
environment = "test"
|
169
|
+
ActiveFedora.init(:environment=>environment, :fedora_config_path=>config_file)
|
170
|
+
end
|
171
|
+
|
172
|
+
it "can tell its config paths" do
|
173
|
+
@configurator.init
|
174
|
+
@configurator.should respond_to(:solr_config_path)
|
175
|
+
end
|
176
|
+
it "loads a config from the current working directory as a second choice" do
|
177
|
+
Dir.stubs(:getwd).returns(@fake_rails_root)
|
178
|
+
@configurator.init
|
179
|
+
@configurator.get_config_path(:fedora).should eql("#{@fake_rails_root}/config/fedora.yml")
|
180
|
+
@configurator.solr_config_path.should eql("#{@fake_rails_root}/config/solr.yml")
|
181
|
+
end
|
182
|
+
it "loads the config that ships with this gem as a last choice" do
|
183
|
+
Dir.stubs(:getwd).returns("/fake/path")
|
184
|
+
logger.expects(:warn).with("Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml to ActiveFedora - ie. ActiveFedora.init(:fedora_config_path => '/path/to/fedora.yml') - or set Rails.root and put fedora.yml into \#{Rails.root}/config.").times(3)
|
185
|
+
@configurator.init
|
186
|
+
expected_config = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "config"))
|
187
|
+
@configurator.get_config_path(:fedora).should eql(expected_config+'/fedora.yml')
|
188
|
+
@configurator.solr_config_path.should eql(expected_config+'/solr.yml')
|
189
|
+
end
|
190
|
+
it "raises an error if you pass in a string" do
|
191
|
+
lambda{ @configurator.init("#{@fake_rails_root}/config/fake_fedora.yml") }.should raise_exception(ArgumentError)
|
192
|
+
end
|
193
|
+
it "raises an error if you pass in a non-existant config file" do
|
194
|
+
lambda{ @configurator.init(:fedora_config_path=>"really_fake_fedora.yml") }.should raise_exception(ActiveFedora::ConfigurationError)
|
195
|
+
end
|
196
|
+
|
197
|
+
describe "within Rails" do
|
198
|
+
before(:all) do
|
199
|
+
stub_rails(:root=>File.dirname(__FILE__) + '/../fixtures/rails_root')
|
200
|
+
end
|
201
|
+
|
202
|
+
after(:all) do
|
203
|
+
unstub_rails
|
204
|
+
end
|
205
|
+
|
206
|
+
it "loads a config from Rails.root as a first choice" do
|
207
|
+
@configurator.init
|
208
|
+
@configurator.get_config_path(:fedora).should eql("#{Rails.root}/config/fedora.yml")
|
209
|
+
@configurator.solr_config_path.should eql("#{Rails.root}/config/solr.yml")
|
210
|
+
end
|
211
|
+
|
212
|
+
it "can tell what environment it is set to run in" do
|
213
|
+
stub_rails(:env=>"development")
|
214
|
+
@configurator.init
|
215
|
+
ActiveFedora.environment.should eql("development")
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
##########################
|
222
|
+
|
223
|
+
describe ".build_predicate_config_path" do
|
224
|
+
it "should return the path to the default config/predicate_mappings.yml if no valid path is given" do
|
225
|
+
@configurator.send(:build_predicate_config_path, nil).should == default_predicate_mapping_file
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should return the path to the default config/predicate_mappings.yml if specified config file not found" do
|
229
|
+
File.expects(:exist?).with("/path/to/predicate_mappings.yml").returns(false)
|
230
|
+
File.expects(:exist?).with(default_predicate_mapping_file).returns(true)
|
231
|
+
@configurator.send(:build_predicate_config_path,"/path/to").should == default_predicate_mapping_file
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should return the path to the specified config_path if it exists" do
|
235
|
+
File.expects(:exist?).with("/path/to/predicate_mappings.yml").returns(true)
|
236
|
+
@configurator.expects(:valid_predicate_mapping?).returns(true)
|
237
|
+
@configurator.send(:build_predicate_config_path,"/path/to").should == "/path/to/predicate_mappings.yml"
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
describe ".predicate_config" do
|
242
|
+
before do
|
243
|
+
@configurator.instance_variable_set :@config_loaded, nil
|
244
|
+
end
|
245
|
+
it "should return the default mapping if it has not been initialized" do
|
246
|
+
@configurator.predicate_config().should == YAML.load(File.read(default_predicate_mapping_file))
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
describe ".valid_predicate_mapping" do
|
251
|
+
it "should return true if the predicate mapping has the appropriate keys and value types" do
|
252
|
+
@configurator.send(:valid_predicate_mapping?,default_predicate_mapping_file).should be_true
|
253
|
+
end
|
254
|
+
it "should return false if the mapping is missing the :default_namespace" do
|
255
|
+
mock_yaml({:default_namespace0=>"my_namespace",:predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
|
256
|
+
@configurator.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
257
|
+
end
|
258
|
+
it "should return false if the :default_namespace is not a string" do
|
259
|
+
mock_yaml({:default_namespace=>{:foo=>"bar"}, :predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
|
260
|
+
@configurator.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
261
|
+
end
|
262
|
+
it "should return false if the :predicate_mappings key is missing" do
|
263
|
+
mock_yaml({:default_namespace=>"a string"},"/path/to/predicate_mappings.yml")
|
264
|
+
@configurator.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
265
|
+
end
|
266
|
+
it "should return false if the :predicate_mappings key is not a hash" do
|
267
|
+
mock_yaml({:default_namespace=>"a string",:predicate_mapping=>"another string"},"/path/to/predicate_mappings.yml")
|
268
|
+
@configurator.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
@@ -31,7 +31,6 @@ describe ActiveFedora::SolrService do
|
|
31
31
|
end
|
32
32
|
it "should try to initialize if the service not initialized, and fail if it does not succeed" do
|
33
33
|
Thread.current[:solr_service].should be_nil
|
34
|
-
ActiveFedora.expects(:load_configs)
|
35
34
|
ActiveFedora::SolrService.expects(:register)
|
36
35
|
proc{ActiveFedora::SolrService.instance}.should raise_error(ActiveFedora::SolrNotInitialized)
|
37
36
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424135
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 4
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 4.0.0.
|
11
|
+
- 9
|
12
|
+
version: 4.0.0.rc9
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Matt Zumwalt
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-03-
|
22
|
+
date: 2012-03-08 00:00:00 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
prerelease: false
|
@@ -378,6 +378,7 @@ files:
|
|
378
378
|
- lib/active_fedora/datastreams.rb
|
379
379
|
- lib/active_fedora/delegating.rb
|
380
380
|
- lib/active_fedora/digital_object.rb
|
381
|
+
- lib/active_fedora/file_configurator.rb
|
381
382
|
- lib/active_fedora/file_management.rb
|
382
383
|
- lib/active_fedora/fixture_exporter.rb
|
383
384
|
- lib/active_fedora/fixture_loader.rb
|
@@ -417,6 +418,7 @@ files:
|
|
417
418
|
- solr/config/schema-1.5.xml
|
418
419
|
- solr/config/schema.xml
|
419
420
|
- solr/config/solrconfig-1.5.xml
|
421
|
+
- spec/config_helper.rb
|
420
422
|
- spec/fixtures/changeme155.xml
|
421
423
|
- spec/fixtures/dino.jpg
|
422
424
|
- spec/fixtures/dino_jpg_no_file_ext
|
@@ -512,12 +514,13 @@ files:
|
|
512
514
|
- spec/unit/base_file_management_spec.rb
|
513
515
|
- spec/unit/base_spec.rb
|
514
516
|
- spec/unit/callback_spec.rb
|
517
|
+
- spec/unit/code_configurator_spec.rb
|
515
518
|
- spec/unit/config_spec.rb
|
516
519
|
- spec/unit/content_model_spec.rb
|
517
520
|
- spec/unit/datastream_collections_spec.rb
|
518
|
-
- spec/unit/datastream_concurrency_spec.rb
|
519
521
|
- spec/unit/datastream_spec.rb
|
520
522
|
- spec/unit/datastreams_spec.rb
|
523
|
+
- spec/unit/file_configurator_spec.rb
|
521
524
|
- spec/unit/has_many_collection_spec.rb
|
522
525
|
- spec/unit/inheritance_spec.rb
|
523
526
|
- spec/unit/metadata_datastream_spec.rb
|
@@ -574,6 +577,7 @@ signing_key:
|
|
574
577
|
specification_version: 3
|
575
578
|
summary: A convenience libary for manipulating MODS (Metadata Object Description Schema) documents.
|
576
579
|
test_files:
|
580
|
+
- spec/config_helper.rb
|
577
581
|
- spec/fixtures/changeme155.xml
|
578
582
|
- spec/fixtures/dino.jpg
|
579
583
|
- spec/fixtures/dino_jpg_no_file_ext
|
@@ -669,12 +673,13 @@ test_files:
|
|
669
673
|
- spec/unit/base_file_management_spec.rb
|
670
674
|
- spec/unit/base_spec.rb
|
671
675
|
- spec/unit/callback_spec.rb
|
676
|
+
- spec/unit/code_configurator_spec.rb
|
672
677
|
- spec/unit/config_spec.rb
|
673
678
|
- spec/unit/content_model_spec.rb
|
674
679
|
- spec/unit/datastream_collections_spec.rb
|
675
|
-
- spec/unit/datastream_concurrency_spec.rb
|
676
680
|
- spec/unit/datastream_spec.rb
|
677
681
|
- spec/unit/datastreams_spec.rb
|
682
|
+
- spec/unit/file_configurator_spec.rb
|
678
683
|
- spec/unit/has_many_collection_spec.rb
|
679
684
|
- spec/unit/inheritance_spec.rb
|
680
685
|
- spec/unit/metadata_datastream_spec.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'active_fedora'
|
4
|
-
require "rexml/document"
|
5
|
-
|
6
|
-
describe ActiveFedora::Datastream do
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
@test_object = ActiveFedora::Base.new
|
10
|
-
@test_datastream = ActiveFedora::Datastream.new(@test_object.inner_object, 'abcd')
|
11
|
-
@test_datastream.content = 'hi there'
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should provide #last_modified_in_repository" do
|
15
|
-
pending
|
16
|
-
@test_datastream.should respond_to(:last_modified_in_repository)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should update @last_modified when #save or #content is called' do
|
20
|
-
pending
|
21
|
-
# ActiveFedora::Repository.any_instance.stubs(:save)
|
22
|
-
# ActiveFedora::Repository.any_instance.stubs(:fetch_custom)
|
23
|
-
@test_datastream.expects(:last_modified=).times(2)
|
24
|
-
@test_datastream.expects(:last_modified_in_repository).times(3)
|
25
|
-
@test_datastream.save
|
26
|
-
@test_datastream.content
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#save' do
|
30
|
-
it 'should not save to fedora if @last_modified does not match the datetime from fedora'
|
31
|
-
it 'should save to fedora if @last_modified matches the datetime from fedora'
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#last_modified_in_repository' do
|
35
|
-
it "should retrieve a datetime from fedora"
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should provide #check_concurrency' do
|
39
|
-
@test_datastream.should respond_to(:check_concurrency)
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#check_concurrency' do
|
43
|
-
it 'should return true if @last_modified matches the datetime from fedora' do
|
44
|
-
pending
|
45
|
-
@test_datastream.expects(:last_modified_in_repository).returns("2008-10-17T00:17:18.194Z")
|
46
|
-
@test_datastream.last_modified = "2008-10-17T00:17:18.194Z"
|
47
|
-
@test_datastream.check_concurrency.should == true
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should raise an error if @last_modified does not match the datetime from fedora' do
|
51
|
-
pending
|
52
|
-
@test_datastream.expects(:last_modified_in_repository).returns("blah blah blah")
|
53
|
-
@test_datastream.last_modified = "2008-10-17T00:17:18.194Z"
|
54
|
-
@test_datastream.check_concurrency.should raise_error()
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|