Skip to content

Commit

Permalink
Ensure an exact match is not "overruled" by a regex match
Browse files Browse the repository at this point in the history
  • Loading branch information
epologee committed Oct 9, 2014
1 parent 5049a86 commit 433916d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/VCRCassetteTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ - (void)testRegExRecordingForRequestGreedy {
XCTAssertNil([cassette recordingForRequest:request]);
}

- (void)testRecordingForRequestNotRegEx {
NSString *path = @"http://foo?key=xyz";
NSURL *url = [NSURL URLWithString:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

id json = @{ @"method": @"GET", @"uri": @"http://foo[?]*.*", @"body": @"Foo Bar" };
VCRRecording *regexRecording = [[VCRRecording alloc] initWithJSON:json];

VCRCassette *cassette = self.cassette;
[cassette addRecording:regexRecording];

json = @{ @"method": @"GET", @"uri": path, @"body": @"Foo Baz" };
VCRRecording *pathRecording = [[VCRRecording alloc] initWithJSON:json];
[cassette addRecording:pathRecording];

XCTAssertEqualObjects([cassette recordingForRequest:request], pathRecording, @"");
}

- (void)testKeyOrderingForJson {
id json = @{ @"method": @"get", @"uri": @"http://foo", @"body": @"GET Foo Bar Baz" };
VCRRecording *recording = [[VCRRecording alloc] initWithJSON:json];
Expand Down

0 comments on commit 433916d

Please sign in to comment.