Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lib/unread/readable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ def read_scope(reader)
end

def readable_parent
current_klass = self
while(ReadMark.readable_classes.include?(current_klass.superclass)) do
current_klass = current_klass.superclass
end
current_klass
self.ancestors.find { |ancestor| ReadMark.readable_classes.include?(ancestor) }
end

def cleanup_read_marks!
Expand Down
2 changes: 2 additions & 0 deletions spec/app/models/multi_level_sti_readable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class MultiLevelStiReadable < Email
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
require 'app/models/sti_reader'
require 'app/models/document'
require 'app/models/email'
require 'app/models/multi_level_sti_readable'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Expand Down
2 changes: 1 addition & 1 deletion spec/unread/garbage_collector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
wait
@email1 = Email.create!
wait
@email2 = Email.create!
@email2 = MultiLevelStiReadable.create!
end

describe :run! do
Expand Down
2 changes: 1 addition & 1 deletion spec/unread/readable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
wait
@email1 = Email.create!
wait
@email2 = Email.create!
@email2 = MultiLevelStiReadable.create!
end

describe :unread_by do
Expand Down
4 changes: 2 additions & 2 deletions spec/unread/reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
wait
@email1 = Email.create!
wait
@email2 = Email.create!
@email2 = MultiLevelStiReadable.create!
end

describe :have_not_read do
Expand Down Expand Up @@ -178,4 +178,4 @@
expect(readers[0].have_read?(@email2)).to be_falsey
end
end
end
end