NSControllerRACSupportSpec.m 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // NSControllerRACSupportSpec.m
  3. // ReactiveCocoa
  4. //
  5. // Created by Uri Baghin on 26/10/13.
  6. // Copyright (c) 2013 GitHub, Inc. All rights reserved.
  7. //
  8. #import <Quick/Quick.h>
  9. #import <Nimble/Nimble.h>
  10. #import <AppKit/AppKit.h>
  11. #import "RACKVOChannel.h"
  12. @interface RACTestController : NSController
  13. @property (nonatomic, strong) id object;
  14. @end
  15. @implementation RACTestController
  16. @end
  17. QuickSpecBegin(NSControllerRACSupportSpec)
  18. qck_it(@"RACKVOChannel should support NSController", ^{
  19. RACTestController *a = [[RACTestController alloc] init];
  20. RACTestController *b = [[RACTestController alloc] init];
  21. RACChannelTo(a, object) = RACChannelTo(b, object);
  22. expect(a.object).to(beNil());
  23. expect(b.object).to(beNil());
  24. a.object = a;
  25. expect(a.object).to(equal(a));
  26. expect(b.object).to(equal(a));
  27. b.object = b;
  28. expect(a.object).to(equal(b));
  29. expect(b.object).to(equal(b));
  30. a.object = nil;
  31. expect(a.object).to(beNil());
  32. expect(b.object).to(beNil());
  33. });
  34. QuickSpecEnd