ddr-models 3.0.6 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e8b6114aefc7b2bd337f0c344ea055d956c8288
4
- data.tar.gz: c020e2c7a977a37fd929096ad421a0063f1d57ac
3
+ metadata.gz: bc755e51981ed91392c59b4a6f074b9f97a4e267
4
+ data.tar.gz: 3d3d35677acfcce375f0e96ea5504afd17fcdebe
5
5
  SHA512:
6
- metadata.gz: 45656d4aeb558283fcc2142ca27530ed5cc10cc8c2441046be689a509ad51df1b3c693111e741681c1e66440847e78a6fc16a2b6096074b361351211e3a3b3d7
7
- data.tar.gz: b97ed64351c0983e53c6a003c2d771befbdcb54c3b0130e469f586d83a0bec9d588660462532fa21f949d3892085e6e910273fcbf5471e4104dcbf0e943b0cd2
6
+ metadata.gz: a40afd627cbc299fba97ccbcdcb210767048b76b6d190b48b2657c3cf9b4a77b5a33430f54743f42a82bc82d1f3193dfda4238151bbcae74cd3255b861e13991
7
+ data.tar.gz: aeba98c52e7467fe99cbad263d58198a3a6cc5363058f243e75f5b7d7c8c9bd11f5470920674718afa4859c75d2fcffe9c068ca3318b2d7b2ba7b5a6be1c6368
@@ -0,0 +1,5 @@
1
+ ActiveFedora::File.class_eval do
2
+ after_save do
3
+ ActiveSupport::Notifications.instrument(Ddr::Notifications::FILE_SAVE, uri: uri)
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "3.0.6"
3
+ VERSION = "3.0.7"
4
4
  end
5
5
  end
@@ -8,6 +8,8 @@ module Ddr
8
8
  DELETION = "deletion.events.ddr"
9
9
  MIGRATION = "migration.events.ddr"
10
10
 
11
+ FILE_SAVE = "save.file.active_fedora"
12
+
11
13
  def self.notify_event(type, args={})
12
14
  name = "#{type}.events.ddr"
13
15
  ActiveSupport::Notifications.instrument(name, args)
@@ -0,0 +1,19 @@
1
+ RSpec.describe ActiveFedora::File do
2
+ describe "after_save" do
3
+ let(:callback) {
4
+ proc { |*args| nil }
5
+ }
6
+ around(:example) do |example|
7
+ ActiveSupport::Notifications.subscribed(callback, Ddr::Notifications::FILE_SAVE) do
8
+ example.run
9
+ end
10
+ end
11
+ it "sends a notification" do
12
+ expect(callback).to receive(:call).once
13
+ file = described_class.new
14
+ file.content = "foo"
15
+ file.save
16
+ file.save
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-07 00:00:00.000000000 Z
12
+ date: 2016-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -408,6 +408,7 @@ files:
408
408
  - bin/rails
409
409
  - config/fedora.yml
410
410
  - config/initializers/active_fedora_base.rb
411
+ - config/initializers/active_fedora_file.rb
411
412
  - config/initializers/devise.rb
412
413
  - config/initializers/subscriptions.rb
413
414
  - config/locales/ddr-models.en.yml
@@ -697,6 +698,7 @@ files:
697
698
  - spec/managers/derivatives_manager_spec.rb
698
699
  - spec/managers/technical_metadata_manager_spec.rb
699
700
  - spec/models/active_fedora_base_spec.rb
701
+ - spec/models/active_fedora_file_spec.rb
700
702
  - spec/models/admin_set_spec.rb
701
703
  - spec/models/administrative_metadata_spec.rb
702
704
  - spec/models/attached_files_profile_spec.rb
@@ -873,6 +875,7 @@ test_files:
873
875
  - spec/managers/derivatives_manager_spec.rb
874
876
  - spec/managers/technical_metadata_manager_spec.rb
875
877
  - spec/models/active_fedora_base_spec.rb
878
+ - spec/models/active_fedora_file_spec.rb
876
879
  - spec/models/admin_set_spec.rb
877
880
  - spec/models/administrative_metadata_spec.rb
878
881
  - spec/models/attached_files_profile_spec.rb