Skip to content

Commit

Permalink
scrub old unsent messages
Browse files Browse the repository at this point in the history
fixes CNVS-25039

test plan
- run specs

Change-Id: Id7b48c83d674d3fbe932f7e4f22630a702fedbde
Reviewed-on: https://gerrit.instructure.com/68127
Reviewed-by: Andrew Butterfield <[email protected]>
Tested-by: Jenkins
QA-Review: Heath Hales <[email protected]>
Product-Review: Joel Hough <[email protected]>
  • Loading branch information
JoelHough committed Dec 11, 2015
1 parent ca344bc commit 2b703a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/message_scrubber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def delete_messages(scope)
#
# Returns a column name string.
def filter_attribute
'sent_at'
'updated_at'
end

# Internal: The class object to delete records from (e.g. 'Message').
Expand Down
11 changes: 6 additions & 5 deletions spec/lib/message_scrubber_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
describe MessageScrubber do

# Helpers
def message(sent_at)
message = Message.new(notification: @notification, context: @context,
def message(updated_at)
Timecop.travel(updated_at) do
message = Message.new(notification: @notification, context: @context,
communication_channel: @recipient.communication_channel)
message.sent_at = sent_at
message.save!
message
message.save!
message
end
end

def old_messages(count = 2)
Expand Down

0 comments on commit 2b703a1

Please sign in to comment.