unread-mongoid 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fff81cda9ab35182ca6e221415467c3b36df486d
4
- data.tar.gz: 58fbf8f25b5b3c06c858c0e68017b1ad8a50e202
3
+ metadata.gz: adc69505c8208e251baa393dbf71f86609691942
4
+ data.tar.gz: 07e4fff7bf3a8ea8757a1e2ea96d37dddc540ec4
5
5
  SHA512:
6
- metadata.gz: 0d9528baf77bf362f20bf016193cd8ccf631fac799c2984353c400cff8e478b5aefb0983659d32f1cc69a55fbbaf6cdbe7496d69e2f01abd6abd91a118e0436e
7
- data.tar.gz: 6a69cc802404a2b5b4708046de7bd074903e2fe0d2258c11339ab312b68d01a2c9790eaec163f823d8f77c3d514f768c33b5b8585914e7e01164abfc3e4a931b
6
+ metadata.gz: 18ac058f67de7193ece5002d70a923a96ddfe45a21f33b817c5835f60fd83f34d3a56c3e3f730768e3571e0109f0edfea73e7f969489b27fb88f71b1e65b2eb2
7
+ data.tar.gz: 29c248a3de7261a8de7a5b23564206cab8cc12c4bb574ccc5a2693097668f8d3bc782319dfdcad921d8f9c691db0a2f9bdd4c6d4b0ce167f60fe2c7a5be053ac
data/README.md CHANGED
@@ -4,7 +4,7 @@ Unread-Mongoid
4
4
  Ruby gem to manage read/unread status of Mongoid objects.
5
5
 
6
6
  ## Credit
7
- First and foremost this is a fork of [Unread](https://github.com/ledermann/unread) by [Georg Ledermann](http://www.georg-ledermann.de). If you don't have to use Mongo for this I highly reccoment you use his gem, this is a task much better suited to a relational db.
7
+ First and foremost this is a fork of [Unread](https://github.com/ledermann/unread) by [Georg Ledermann](http://www.georg-ledermann.de). If you don't have to use Mongo for this I highly reccomend you use his gem, this is a task much better suited to a relational db.
8
8
 
9
9
  ## Features
10
10
 
@@ -7,7 +7,7 @@ module UnreadMongoid
7
7
  def acts_as_reader
8
8
  ReadMark.belongs_to :user, :class_name => self.to_s
9
9
 
10
- has_many :read_marks, :dependent => :delete_all, :foreign_key => 'user_id', :inverse_of => :user
10
+ has_many :read_marks, :dependent => :destroy, :foreign_key => 'user_id', :inverse_of => :user
11
11
 
12
12
  after_create do |user|
13
13
  # We assume that a new user should not be tackled by tons of old messages
@@ -26,7 +26,7 @@ module UnreadMongoid
26
26
 
27
27
  self.readable_options = options
28
28
 
29
- has_many :read_marks, :as => :readable, :dependent => :delete_all
29
+ has_many :read_marks, :as => :readable, :dependent => :destroy
30
30
 
31
31
  # :(
32
32
  after_save do |doc|
@@ -1,3 +1,3 @@
1
1
  module UnreadMongoid
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/test/unread_test.rb CHANGED
@@ -169,6 +169,13 @@ class UnreadTest < ActiveSupport::TestCase
169
169
  assert_equal 2, ReadMark.global.count
170
170
  end
171
171
 
172
+ def test_destroys_readmarks_when_readable_is_destroyed
173
+ count = ReadMark.count
174
+ @email1.mark_as_read! for: @reader
175
+ assert_equal count + 1, ReadMark.count
176
+ @email1.destroy
177
+ assert_equal count, ReadMark.count
178
+ end
172
179
  private
173
180
  def wait
174
181
  Timecop.freeze(1.minute.from_now.change(:usec => 0))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unread-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hunter Haydel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-01 00:00:00.000000000 Z
12
+ date: 2014-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid