Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 60 lines (50 sloc) 2.441 kb
7d6a323 @tomaz Copied all the changes from the old generating branch.
authored
1 //
2 // GBTemplateVariablesProvider-CommonTesting.m
3 // appledoc
4 //
5 // Created by Tomaz Kragelj on 1.10.10.
6 // Copyright (C) 2010 Gentle Bytes. All rights reserved.
7 //
8
9 #import "GBApplicationSettingsProvider.h"
e467b50 @tomaz Renamed GBTemplateVariablesProvider to GBHTMLTemplateVariablesProvider a...
authored
10 #import "GBHTMLTemplateVariablesProvider.h"
7d6a323 @tomaz Copied all the changes from the old generating branch.
authored
11 #import "GBTokenizer.h"
12
13 @interface GBTemplateVariablesProviderCommonTesting : GHTestCase
f18465e @tomaz Fixed HTML footer year and last update strings. Closes #49.
authored
14 - (NSDateFormatter *)yearFormatterFromSettings:(GBApplicationSettingsProvider *)settings;
15 - (NSDateFormatter *)yearToDayFormatterFromSettings:(GBApplicationSettingsProvider *)settings;
7d6a323 @tomaz Copied all the changes from the old generating branch.
authored
16 @end
17
18 @implementation GBTemplateVariablesProviderCommonTesting
19
20 - (void)testVariablesForClass_shouldPrepareDefaultVariables {
21 // setup
f18465e @tomaz Fixed HTML footer year and last update strings. Closes #49.
authored
22 id settings = [GBTestObjectsRegistry realSettingsProvider];
23 GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:settings];
7d6a323 @tomaz Copied all the changes from the old generating branch.
authored
24 GBClassData *class = [GBClassData classDataWithName:@"Class"];
25 // execute
26 NSDictionary *vars = [provider variablesForClass:class withStore:[GBTestObjectsRegistry store]];
27 // verify - just basic tests...
28 assertThat([vars objectForKey:@"page"], isNot(nil));
29 assertThat([vars valueForKeyPath:@"page.title"], isNot(nil));
30 assertThat([vars valueForKeyPath:@"page.specifications"], isNot(nil));
31 assertThat([vars objectForKey:@"object"], is(class));
32 }
33
f18465e @tomaz Fixed HTML footer year and last update strings. Closes #49.
authored
34 - (void)testVariableForClass_shouldPrepareFooterVariables {
35 // setup
36 id settings = [GBTestObjectsRegistry realSettingsProvider];
37 GBHTMLTemplateVariablesProvider *provider = [GBHTMLTemplateVariablesProvider providerWithSettingsProvider:settings];
38 GBClassData *class = [GBClassData classDataWithName:@"Class"];
39 // execute
40 NSDictionary *vars = [provider variablesForClass:class withStore:[GBTestObjectsRegistry store]];
41 // verify - just basic tests...
42 NSDate *date = [NSDate date];
43 NSString *year = [[self yearFormatterFromSettings:settings] stringFromDate:date];
44 NSString *day = [[self yearToDayFormatterFromSettings:settings] stringFromDate:date];
45 assertThat([vars valueForKeyPath:@"page.copyrightDate"], is(year));
46 assertThat([vars valueForKeyPath:@"page.lastUpdatedDate"], is(day));
47 }
48
49 #pragma mark Creation methods
50
51 - (NSDateFormatter *)yearFormatterFromSettings:(GBApplicationSettingsProvider *)settings {
52 return [settings valueForKey:@"yearDateFormatter"];
53 }
54
55 - (NSDateFormatter *)yearToDayFormatterFromSettings:(GBApplicationSettingsProvider *)settings {
56 return [settings valueForKey:@"yearToDayDateFormatter"];
57 }
58
7d6a323 @tomaz Copied all the changes from the old generating branch.
authored
59 @end
Something went wrong with that request. Please try again.