我正在使用webmock和VCR进行一些基本的Rspec测试,但我想为我的验收测试禁用webmock,以便我可以实际发出外部HTTP请求。
最好的方法是什么?
答案 0 :(得分:13)
你可以做到
-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker{
PlaceData *currentMarker = [self findDataByMarker:marker];
UIView *dialogView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 261, 95)];
// Create background image
UIImageView *dialogBackground = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"MapDialog.png"]];
[dialogView addSubview:dialogBackground];
UIImageView * thumbnail = [[UIImageView alloc] init];
[thumbnail sd_setImageWithURL:[NSURL URLWithString:currentMarker.thumbnail] placeholderImage:[UIImage imageNamed:@"placeholder.png"] options:SDWebImageRefreshCached];
NSLog(@"URL %@", currentMarker.thumbnail);
NSLog(@"thumbnail %@",thumbnail);
CGRect tmpFrame = thumbnail.frame;
tmpFrame.origin.x = 15;
tmpFrame.origin.y = 14;
tmpFrame.size.width = 55;
tmpFrame.size.height = 55;
thumbnail.frame = tmpFrame;
thumbnail.contentMode = UIViewContentModeScaleToFill;
[dialogView addSubview:thumbnail];
return dialogView;
答案 1 :(得分:3)
来自README:
WebMock.allow_net_connect!