Permalink
Browse files

Fixed unit tests which were dependent on project name and company set…

…tings.

Forgot to run unit tests after 93203e1 commit.
  • Loading branch information...
tomaz committed Dec 13, 2010
1 parent dacb6c8 commit 82f449add8aafef1af4e1d32081dca9f8d5889aa
@@ -17,7 +17,7 @@ @implementation GBTemplateVariablesProviderCommonTesting
- (void)testVariablesForClass_shouldPrepareDefaultVariables {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
// execute
NSDictionary *vars = [provider variablesForClass:class withStore:[GBTestObjectsRegistry store]];
@@ -19,7 +19,7 @@ @implementation GBTemplateVariablesProviderObjectSpecificationsTesting
- (void)testVariablesForClass_inheritsFrom_shouldIgnoreSpecificationForRootClass {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
// execute
NSDictionary *vars = [provider variablesForClass:class withStore:[GBTestObjectsRegistry store]];
@@ -30,7 +30,7 @@ - (void)testVariablesForClass_inheritsFrom_shouldIgnoreSpecificationForRootClass
- (void)testVariablesForClass_inheritsFrom_shouldPrepareSpecificationForUnknownSuperclass {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
class.nameOfSuperclass = @"NSObject";
// execute
@@ -46,7 +46,7 @@ - (void)testVariablesForClass_inheritsFrom_shouldPrepareSpecificationForUnknownS
- (void)testVariablesForClass_inheritsFrom_shouldPrepareSpecificationForKnownSuperclass {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *superclass = [GBClassData classDataWithName:@"Base"];
GBStore *store = [GBTestObjectsRegistry store];
[store registerClass:superclass];
@@ -66,7 +66,7 @@ - (void)testVariablesForClass_inheritsFrom_shouldPrepareSpecificationForKnownSup
- (void)testVariablesForClass_inheritsFrom_shouldPrepareSpecificationForClassHierarchy {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *level2 = [GBClassData classDataWithName:@"Level2"];
level2.nameOfSuperclass = @"NSObject";
GBClassData *level1 = [GBClassData classDataWithName:@"Level1"];
@@ -97,7 +97,7 @@ - (void)testVariablesForClass_inheritsFrom_shouldPrepareSpecificationForClassHie
- (void)testVariablesForClass_conformsTo_shouldIgnoreSpecificationForNonAdoptingClass {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
// execute
NSDictionary *vars = [provider variablesForClass:class withStore:[GBTestObjectsRegistry store]];
@@ -108,7 +108,7 @@ - (void)testVariablesForClass_conformsTo_shouldIgnoreSpecificationForNonAdopting
- (void)testVariablesForClass_conformsTo_shouldPrepareSpecificationForUnknownProtocol {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
[class.adoptedProtocols registerProtocol:[GBProtocolData protocolDataWithName:@"Protocol"]];
// execute
@@ -124,7 +124,7 @@ - (void)testVariablesForClass_conformsTo_shouldPrepareSpecificationForUnknownPro
- (void)testVariablesForClass_conformsTo_shouldPrepareSpecificationForKnownProtocol {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBProtocolData *protocol = [GBProtocolData protocolDataWithName:@"Protocol"];
GBStore *store = [GBTestObjectsRegistry store];
[store registerProtocol:protocol];
@@ -143,7 +143,7 @@ - (void)testVariablesForClass_conformsTo_shouldPrepareSpecificationForKnownProto
- (void)testVariablesForClass_conformsTo_shouldPrepareSpecificationForComplexProtocolsList {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBProtocolData *protocol1 = [GBProtocolData protocolDataWithName:@"Protocol1"];
GBProtocolData *protocol2 = [GBProtocolData protocolDataWithName:@"Protocol2"];
GBProtocolData *protocol3 = [GBProtocolData protocolDataWithName:@"Protocol3"];
@@ -173,7 +173,7 @@ - (void)testVariablesForClass_conformsTo_shouldPrepareSpecificationForComplexPro
- (void)testVariablesForClass_declaredIn_shouldPrepareSpecificationForSingleSourceInfo {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
[class registerSourceInfo:[GBSourceInfo infoWithFilename:@"file.h" lineNumber:10]];
// execute
@@ -189,7 +189,7 @@ - (void)testVariablesForClass_declaredIn_shouldPrepareSpecificationForSingleSour
- (void)testVariablesForClass_declaredIn_shouldPrepareSpecificationForMultipleSourceInfos {
// setup
- GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBApplicationSettingsProvider provider]];
+ GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:[GBTestObjectsRegistry realSettingsProvider]];
GBClassData *class = [GBClassData classDataWithName:@"Class"];
[class registerSourceInfo:[GBSourceInfo infoWithFilename:@"file1.h" lineNumber:10]];
[class registerSourceInfo:[GBSourceInfo infoWithFilename:@"file2.h" lineNumber:55]];
@@ -11,6 +11,7 @@
@interface GBTestObjectsRegistry : NSObject
++ (id)realSettingsProvider;
+ (OCMockObject *)mockSettingsProvider;
+ (void)settingsProvider:(OCMockObject *)provider keepObjects:(BOOL)objects keepMembers:(BOOL)members;
@@ -7,6 +7,7 @@
//
#import "GBApplicationSettingsProviding.h"
+#import "GBApplicationSettingsProvider.h"
#import "GBDataObjects.h"
#import "GBTestObjectsRegistry.h"
@@ -16,8 +17,17 @@ @implementation GBTestObjectsRegistry
#pragma mark Common objects creation methods
++ (id)realSettingsProvider {
+ GBApplicationSettingsProvider *result = [GBApplicationSettingsProvider provider];
+ result.projectName = @"project";
+ result.projectCompany = @"company";
+ return result;
+}
+
+ (OCMockObject *)mockSettingsProvider {
OCMockObject *result = [OCMockObject niceMockForProtocol:@protocol(GBApplicationSettingsProviding)];
+ [[[result stub] andReturn:@"project"] projectName];
+ [[[result stub] andReturn:@"company"] projectCompany];
[[[result stub] andReturn:[GBCommentComponentsProvider provider]] commentComponents];
[[[result stub] andReturn:[GBApplicationStringsProvider provider]] stringTemplates];
return result;

0 comments on commit 82f449a

Please sign in to comment.