Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Readme: Testing with rspec. #12

wants to merge 1 commit into from

2 participants


No description provided.


Hm, thanks for your work, but I don't like the idea of testing gem features in the application. The gem already includes some tests, so there is no need to test it in the application again.

@ledermann ledermann closed this

The idea is not to test the Gem, but to overcome the bug of not created/assumed read marks.
When you create factories with dependent model, that acts_as_unread, the read marks are not created if gap between created_at times is less than 0.002sec (if i'm not mistaken).

This fix helps to figure this out and make your test pass every time you run it.


Do you agree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 23, 2012
  1. @sadfuzzy

    Readme: Testing with rspec.

    sadfuzzy authored
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 0 deletions.
  1. +26 −0
@@ -138,6 +138,32 @@ AND messages.created_at > '2010-10-20 08:50:00'
Hint: You should add a database index on `messages.created_at`.
+## Testing
+### Rspec
+In your tests you will need unread_macros.rb file to fake wait a second after creating an instance, that acts_as_unread:
+module UnreadMacros
+ def wait
+ # Skip one second
+ now = + 1.second
+ Time.stubs(:now).returns(now)
+ end
+Place it in your spec/support directory and modify spec_helper.rb file:
+RSpec.configure do |config|
+ ...
+ config.include UnreadMacros
## Similar tools
There are two other gems/plugins doing a similar job:
Something went wrong with that request. Please try again.