Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 3cf1645

Browse files
committed
Replace Specta with Quick
From Specta's GitHub repo: > Specta is considered a done project [...], we recommend you consider Quick.
1 parent b8058f6 commit 3cf1645

File tree

4 files changed

+56
-55
lines changed

4 files changed

+56
-55
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ target 'WordPressSharedTests' do
2626
pod 'OHHTTPStubs', '~> 9.0'
2727
pod 'OHHTTPStubs/Swift', '~> 9.0'
2828
pod 'OCMock', '~> 3.4'
29-
pod 'Specta', '1.0.7'
29+
pod 'Quick', '~> 6.0'
3030
pod 'Expecta', '1.0.6'
3131
end

Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PODS:
2222
- OHHTTPStubs/OHPathHelpers (9.1.0)
2323
- OHHTTPStubs/Swift (9.1.0):
2424
- OHHTTPStubs/Default
25-
- Specta (1.0.7)
25+
- Quick (6.0.0)
2626

2727
DEPENDENCIES:
2828
- CocoaLumberjack (~> 3.4)
@@ -31,7 +31,7 @@ DEPENDENCIES:
3131
- OCMock (~> 3.4)
3232
- OHHTTPStubs (~> 9.0)
3333
- OHHTTPStubs/Swift (~> 9.0)
34-
- Specta (= 1.0.7)
34+
- Quick (~> 6.0)
3535

3636
SPEC REPOS:
3737
trunk:
@@ -40,16 +40,16 @@ SPEC REPOS:
4040
- FormatterKit
4141
- OCMock
4242
- OHHTTPStubs
43-
- Specta
43+
- Quick
4444

4545
SPEC CHECKSUMS:
4646
CocoaLumberjack: e8955b9d337ac307103b0a34fd141c32f27e53c5
4747
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
4848
FormatterKit: 4b8f29acc9b872d5d12a63efb560661e8f2e1b98
4949
OCMock: 29f6e52085b4e7d9b075cbf03ed7c3112f82f934
5050
OHHTTPStubs: 90eac6d8f2c18317baeca36698523dc67c513831
51-
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
51+
Quick: 4d5ab9e81f0a632cbf9bc4f3069b55e5eeb175df
5252

53-
PODFILE CHECKSUM: ace859cfebf0a7a9ce551e216483b641cd360251
53+
PODFILE CHECKSUM: ada0d4ed55a22efd07f3eb930484d8c31a5efcd4
5454

5555
COCOAPODS: 1.11.3

WordPressShared.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@
675675
"${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework",
676676
"${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework",
677677
"${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework",
678-
"${BUILT_PRODUCTS_DIR}/Specta/Specta.framework",
678+
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
679679
);
680680
name = "[CP] Embed Pods Frameworks";
681681
outputPaths = (
@@ -684,7 +684,7 @@
684684
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework",
685685
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OCMock.framework",
686686
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OHHTTPStubs.framework",
687-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Specta.framework",
687+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework",
688688
);
689689
runOnlyForDeploymentPostprocessing = 0;
690690
shellPath = /bin/sh;
Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
1-
#import <Specta/Specta.h>
2-
#define EXP_SHORTHAND
3-
#import <Expecta/Expecta.h>
1+
#import <Quick/Quick.h>
42
#import <OCMock/OCMock.h>
53
#import "TestAnalyticsTracker.h"
64

75
// Rather than duplicate these tests for each method, we abstracted them into a set of
86
// shared examples and use an NSInvocation object to tell us what to call.
9-
SharedExampleGroupsBegin(WPAnalyticsMethodBehavior)
10-
11-
sharedExamplesFor(@"a WPAnalyticsTracker method", ^(NSDictionary *data) {
12-
NSInvocation *invocation = data[@"invocation"];
13-
it(@"should not be called if tracker isn't registered", ^{
14-
id trackerMock = OCMStrictClassMock([TestAnalyticsTracker class]);
15-
id expectation = [trackerMock reject];
16-
[invocation invokeWithTarget:expectation];
17-
[trackerMock verify];
7+
QuickConfigurationBegin(WPAnalyticsMethodBehavior)
8+
9+
+ (void)configure:(QCKConfiguration *)configuration
10+
{
11+
sharedExamples(@"a WPAnalyticsTracker method", ^(QCKDSLSharedExampleContext context) {
12+
NSInvocation *invocation = context()[@"invocation"];
13+
it(@"should not be called if tracker isn't registered", ^{
14+
id trackerMock = OCMStrictClassMock([TestAnalyticsTracker class]);
15+
id expectation = [trackerMock reject];
16+
[invocation invokeWithTarget:expectation];
17+
[trackerMock verify];
18+
});
19+
20+
it(@"should be called if tracker is registered", ^{
21+
id trackerMock = OCMStrictClassMock([TestAnalyticsTracker class]);
22+
id expectation = [trackerMock expect];
23+
[invocation invokeWithTarget:expectation];
24+
[invocation invokeWithTarget:trackerMock];
25+
[trackerMock verify];
26+
});
27+
28+
it(@"should be called on multiple trackers if registered", ^{
29+
id trackerMock = OCMStrictClassMock([TestAnalyticsTracker class]);
30+
id trackerMock2 = OCMStrictClassMock([TestAnalyticsTracker class]);
31+
id expectation = [trackerMock expect];
32+
id expectation2 = [trackerMock2 expect];
33+
[invocation invokeWithTarget:expectation];
34+
[invocation invokeWithTarget:expectation2];
35+
[invocation invokeWithTarget:trackerMock];
36+
[invocation invokeWithTarget:trackerMock2];
37+
[trackerMock verify];
38+
[trackerMock2 verify];
39+
});
1840
});
19-
20-
it(@"should be called if tracker is registered", ^{
21-
id trackerMock = OCMStrictClassMock([TestAnalyticsTracker class]);
22-
id expectation = [trackerMock expect];
23-
[invocation invokeWithTarget:expectation];
24-
[invocation invokeWithTarget:trackerMock];
25-
[trackerMock verify];
26-
});
27-
28-
it(@"should be called on multiple trackers if registered", ^{
29-
id trackerMock = OCMStrictClassMock([TestAnalyticsTracker class]);
30-
id trackerMock2 = OCMStrictClassMock([TestAnalyticsTracker class]);
31-
id expectation = [trackerMock expect];
32-
id expectation2 = [trackerMock2 expect];
33-
[invocation invokeWithTarget:expectation];
34-
[invocation invokeWithTarget:expectation2];
35-
[invocation invokeWithTarget:trackerMock];
36-
[invocation invokeWithTarget:trackerMock2];
37-
[trackerMock verify];
38-
[trackerMock2 verify];
39-
});
40-
});
41+
}
4142

42-
SharedExampleGroupsEnd
43+
QuickConfigurationEnd
4344

44-
SpecBegin(WPAnalyticsSpecs)
45+
QuickSpecBegin(WPAnalyticsSpecs)
4546

4647
beforeEach(^{
4748
[WPAnalytics clearTrackers];
@@ -51,24 +52,24 @@
5152
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(beginSession)];
5253
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
5354
[invocation setSelector:@selector(beginSession)];
54-
55-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
55+
56+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
5657
});
5758

5859
describe(@"endSession", ^{
5960
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(endSession)];
6061
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
6162
[invocation setSelector:@selector(endSession)];
6263

63-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
64+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
6465
});
6566

6667
describe(@"refreshMetadata", ^{
6768
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(refreshMetadata)];
6869
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
6970
[invocation setSelector:@selector(refreshMetadata)];
7071

71-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
72+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
7273
});
7374

7475
describe(@"beginTimerForStat:", ^{
@@ -78,7 +79,7 @@
7879
WPAnalyticsStat stat = WPAnalyticsStatApplicationOpened;
7980
[invocation setArgument:&stat atIndex:2];
8081

81-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
82+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
8283
});
8384

8485
describe(@"endTimerForStat:withProperties", ^{
@@ -91,7 +92,7 @@
9192
[invocation setArgument:&stat atIndex:2];
9293
[invocation setArgument:&dict atIndex:3];
9394

94-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
95+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
9596
});
9697

9798
describe(@"track:", ^{
@@ -101,7 +102,7 @@
101102
WPAnalyticsStat stat = WPAnalyticsStatApplicationOpened;
102103
[invocation setArgument:&stat atIndex:2];
103104

104-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
105+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
105106
});
106107

107108
describe(@"track:withProperties:", ^{
@@ -114,7 +115,7 @@
114115
[invocation setArgument:&stat atIndex:2];
115116
[invocation setArgument:&dict atIndex:3];
116117

117-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
118+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
118119
});
119120

120121
describe(@"trackString:", ^{
@@ -124,7 +125,7 @@
124125
NSString *event = @"my_event";
125126
[invocation setArgument:&event atIndex:2];
126127

127-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
128+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
128129
});
129130

130131
describe(@"trackString:withProperties:", ^{
@@ -137,7 +138,7 @@
137138
[invocation setArgument:&event atIndex:2];
138139
[invocation setArgument:&dict atIndex:3];
139140

140-
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
141+
itBehavesLike(@"a WPAnalyticsTracker method", ^{ return @{@"invocation": invocation}; });
141142
});
142143

143-
SpecEnd
144+
QuickSpecEnd

0 commit comments

Comments
 (0)