 		
 		XCTAssertEqual(res.events, correctValues)
 	}
-	
+
+    func testImmediateRetryWithPredicate_Limited() {
+        let correctValues = [
+            next(210, 1),
+            next(220, 2),
+            next(440, 1),
+            next(450, 2),
+            error(460, RepeatTestErrors.fatalError)]
+        
+        // provide simple predicate that always return true
+        var attempts = 0
+        let res = scheduler.start(0, subscribed: 0, disposed: 1000) { () -> Observable<Int> in
+            return self.sampleValues.asObservable().retry(.Immediate(maxAttemptCount: 3), scheduler: self.scheduler) { _ in
+                attempts += 1
+                return attempts == 1
+            }
+        }
+        
+        XCTAssertEqual(res.events, correctValues)
+    }
+
 	func testImmediateNotRetryWithPredicate() {
 		let correctValues = [
 			next(210, 1),

		XCTAssertEqual(res.events, correctValues)
	}
	
	
	func testImmediateRetryWithPredicate() {
		let correctValues = [
			next(210, 1),


class RetryWithBehaviorTests: XCTestCase {
	var sampleValues: TestableObservable<Int>!
    var sampleValuesImmediateError: TestableObservable<Int>!
    var sampleValuesNeverError: TestableObservable<Int>!
	let scheduler = TestScheduler(initialClock: 0)
	
	override func setUp() {
