Skip to content

Commit

Permalink
Update test case to use new short-hand 'factory component' method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Blues committed May 12, 2014
1 parent ccc96e2 commit 1a57c74
Show file tree
Hide file tree
Showing 11 changed files with 4,094 additions and 16,316 deletions.
2 changes: 1 addition & 1 deletion .scripts/pod-update-checksum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
996cc3bd0c9c2f3bae32c67f41e79130d2fe3627
ca6c5b5f89574fddb52d98775eb6d4ff4498b912
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ - (void)postProcessComponentFactory:(TyphoonComponentFactory *)factory
- (void)rollback
{
NSMutableArray *postProcessors = (NSMutableArray *) _factory.factoryPostProcessors;
if (!postProcessors.lastObject == self) {
if (![postProcessors.lastObject isEqual:self]) {
[NSException raise:@"Only the last TyphoonAbstractDetachableComponentFactoryPostProcessor can be rolled-back"
format:NSInternalInconsistencyException];
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Factory/TyphoonComponentFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
- (void)inject:(id)instance;

/**
* Injects the properties and methods of an object, descripted in definition
* Injects the properties and methods of an object, described in definition
*/
- (void)inject:(id)instance withDefinition:(SEL)selector;

Expand Down
25 changes: 17 additions & 8 deletions Tests/Factory/Block/TestAssemblies/MiddleAgesAssembly.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ - (id)knight
{
return [TyphoonDefinition withClass:[Knight class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(quest) with:[self defaultQuest]];
[definition injectProperty:@selector(favoriteDamsels) with:@[@"foo", @"bar"]];
[definition injectProperty:@selector(favoriteDamsels) with:@[
@"foo",
@"bar"
]];
[definition injectProperty:@selector(damselsRescued) with:[[self cavalryMan] property:@selector(damselsRescued)]];
[definition setScope:TyphoonScopeObjectGraph];
}];
Expand Down Expand Up @@ -124,13 +127,19 @@ - (id)swordFactory

- (id)blueSword
{
return [TyphoonDefinition withClass:[Sword class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(swordWithSpecification:) parameters:^(TyphoonMethod *initializer) {
initializer.selector = @selector(swordWithSpecification:);
[initializer injectParameter:@"specification" with:@"blue"];
return [TyphoonDefinition withFactory:[self swordFactory] selector:@selector(swordWithSpecification:)
parameters:^(TyphoonMethod *factoryMethod) {
[factoryMethod injectParameterWith:@"blue"];
}];
definition.factory = [self swordFactory];
}];


// Class:[Sword class] configuration:^(TyphoonDefinition *definition) {
// [definition useInitializer:@selector(swordWithSpecification:) parameters:^(TyphoonMethod *initializer) {
// initializer.selector = @selector(swordWithSpecification:);
// [initializer injectParameter:@"specification" with:@"blue"];
// }];
// definition.factory = [self swordFactory];
// }];
}

- (id)knightWithRuntimeDamselsRescued:(NSNumber *)damselsRescued runtimeFoobar:(NSObject *)runtimeObject
Expand All @@ -143,7 +152,7 @@ - (id)knightWithRuntimeDamselsRescued:(NSNumber *)damselsRescued runtimeFoobar:(

/* Actually 'damselsRescued' replaced with InjectionWithRuntimeArgumentAtIndex(0) and url replaced with InjectionWithRuntimeArgumentAtIndex(1) */
- (id)knightWithRuntimeDamselsRescued:(NSNumber *)damselsRescued runtimeQuestUrl:(NSURL *)url
{
{
return [TyphoonDefinition withClass:[Knight class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithQuest:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self questWithRuntimeUrl:url]];
Expand Down
6 changes: 3 additions & 3 deletions Tests/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ PODS:
- OCHamcrest (1.9)
- OCMockito (0.23):
- OCHamcrest
- Typhoon (2.0.2):
- Typhoon (2.0.3):
- Typhoon/no-arc
- Typhoon/no-arc (2.0.2)
- Typhoon/no-arc (2.0.3)

DEPENDENCIES:
- OCHamcrest (~> 1.9)
Expand All @@ -18,6 +18,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
OCHamcrest: 4696b90a600307734cc554eb043cc98663035d04
OCMockito: 85f910881a3731e17e633fffc6883e8532acf8eb
Typhoon: 78c8e4fe24c4a5457b148d1204340b294a28eb4e
Typhoon: fb0e2bc8efd0ec469b06f3bab122ad153265cf7b

COCOAPODS: 0.32.1
2 changes: 1 addition & 1 deletion Tests/Pods/Local Podspecs/Typhoon.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Tests/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Tests/Pods/Pods-OS X Tests (Cocoapods)-environment.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Tests/Pods/Pods-iOS Tests (Cocoapods)-environment.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1a57c74

Please sign in to comment.