Commit 9c90254

mo khan <mo@mokhan.ca>
2013-05-17 03:03:09
split out movie and movie library to separate files
1 parent 7aa5c0e
Changed files (3)
MovieLibrary/Movie.m
@@ -0,0 +1,5 @@
+@interface Movie : NSObject
+@end
+
+@implementation Movie
+@end
MovieLibrary/MovieLibrary.m
@@ -0,0 +1,29 @@
+@interface MovieLibrary : NSObject
+@property (strong, nonatomic) NSMutableArray *items;
+-(void)add:(Movie*)movie;
+-(int)total_movies;
+-(BOOL)includes:(Movie*)movie;
+@end
+
+@implementation MovieLibrary
+-(id)init
+{
+  self = [super init];
+  if(self) {
+    _items = [[NSMutableArray alloc]init];
+  }
+  return self;
+}
+-(void)add:(Movie*)movie
+{
+  [_items addObject:movie];
+}
+-(int)total_movies
+{
+  return [_items count];
+}
+-(BOOL)includes:(Movie*)movie
+{
+  return [_items containsObject:movie];
+}
+@end
MovieLibraryTests/MovieLibrarySpec.m
@@ -1,41 +1,6 @@
 #import "Kiwi.h"
-
-@interface Movie : NSObject
-@end
-
-@implementation Movie
-@end
-
-@interface MovieLibrary : NSObject
-@property (strong, nonatomic) NSMutableArray *items;
--(void)add:(Movie*)movie;
--(int)total_movies;
--(BOOL)includes:(Movie*)movie;
-@end
-
-@implementation MovieLibrary
--(id)init
-{
-  self = [super init];
-  if(self) {
-    _items = [[NSMutableArray alloc]init];
-  }
-  return self;
-}
--(void)add:(Movie*)movie
-{
-  [_items addObject:movie];
-}
--(int)total_movies
-{
-  return [_items count];
-}
--(BOOL)includes:(Movie*)movie
-{
-  return [_items containsObject:movie];
-}
-@end
-
+#import "../MovieLibrary/Movie.m"
+#import "../MovieLibrary/MovieLibrary.m"
 
 SPEC_BEGIN(MovieLibrarySpec)
 
@@ -47,7 +12,7 @@ describe(@"MovieLibrary", ^{
       __block id blah = nil;
 
       beforeAll(^{
-        sut = [[MovieLibrary alloc]init];
+        sut = [MovieLibrary new];
         brave = [Movie new];
         monsters_inc = [Movie new];
         blah = [Movie new];