Skip to content

Commit

Permalink
Preparing first release on Cocoapods.
Browse files Browse the repository at this point in the history
More unit tests.
Code cleaning.
  • Loading branch information
thibaultcha committed Nov 19, 2013
1 parent 09f3b17 commit 25fd5b4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 26 deletions.
18 changes: 4 additions & 14 deletions TCBlobDownload.podspec
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
Pod::Spec.new do |s|
s.name = "TCBlobDownload"
s.version = "1.3.1"
s.summary = "A short description of TCBlobDownload."
s.description = <<-DESC
A longer description of TCBlobDownload in Markdown format.
* Think: Why did you write this? What is the focus? What does it do?
* CocoaPods will be using this to generate tags, and improve search results.
* Try to keep it short, snappy and to the point.
* Finally, don't worry about the indent, CocoaPods strips it!
DESC
s.version = "1.4.0"
s.summary = "Download big files competitively in Cocoa"
s.homepage = "https://github.com/thibaultCha/TCBlobDownload"
s.license = 'MIT (example)'
s.license = 'MIT'
s.author = { "Thibault Charbonnier" => "thibaultcha@me.com" }

s.platform = :ios
s.ios.deployment_target = '5.0'

s.source = {
:git => "https://github.com/thibaultCha/TCBlobDownload",
:tag => "1.3.1"
:tag => "1.4.0"
}
s.source_files = 'TCBlobDownload/TCBlobDownload/*.{h,m}'
s.requires_arc = true
Expand Down
7 changes: 6 additions & 1 deletion TCBlobDownload/TCBlobDownload/TCBlobDownload.m
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ - (void)cancelDownloadAndRemoveFile:(BOOL)remove
[fm removeItemAtPath:self.pathToFile error:&fileError];
if (fileError) {
TCLog(@"An error occured while removing file - %@", fileError);
// TODO handle error
if (self.errorBlock) {
self.errorBlock(fileError);
}
if ([self.delegate respondsToSelector:@selector(download:didStopWithError:)]) {
[self.delegate download:self didStopWithError:fileError];
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions TCBlobDownload/TCBlobDownloadTests/TCBlobDownloadErrorTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ - (void)tearDown

- (void)testInvalidURL
{
/*[self.manager startDownloadWithURL:[NSURL URLWithString:kInvalidURLToDownload]
[self.manager startDownloadWithURL:[NSURL URLWithString:kInvalidURLToDownload]
customPath:nil
firstResponse:NULL
progress:NULL
Expand All @@ -60,7 +60,7 @@ - (void)testInvalidURL
}
complete:NULL];

[self waitForStatus:XCTAsyncTestCaseStatusSucceeded timeout:5];*/
[self waitForStatus:XCTAsyncTestCaseStatusSucceeded timeout:5];
}

- (void)testHTTPErrorStatusCode
Expand Down
15 changes: 9 additions & 6 deletions TCBlobDownload/TCBlobDownloadTests/TCBlobDownloadTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@interface TCBlobDownloadTests : XCTestCase
@property (nonatomic, strong) TCBlobDownloadManager *manager;
@property (nonatomic, copy) NSURL *validURL;
@property (nonatomic, copy) NSString *testsDirectory;
@end

@implementation TCBlobDownloadTests
Expand All @@ -25,26 +26,28 @@ - (void)setUp

_manager = [[TCBlobDownloadManager alloc] init];
self.validURL = [NSURL URLWithString:kValidURLToDownload];
self.testsDirectory = [NSString pathWithComponents:@[NSHomeDirectory(), pathToDownloadTests]];

__autoreleasing NSError *error;
[[NSFileManager defaultManager] createDirectoryAtPath:[NSString pathWithComponents:@[NSTemporaryDirectory(), pathToDownloadTests]]
[[NSFileManager defaultManager] createDirectoryAtPath:self.testsDirectory
withIntermediateDirectories:YES
attributes:nil
error:&error];

XCTAssertNil(error, @"Error while creating tests directory - %@", error);

[self.manager setDefaultDownloadPath:[NSString pathWithComponents:@[NSTemporaryDirectory(), pathToDownloadTests]]];
[self.manager setDefaultDownloadPath:self.testsDirectory];
}

- (void)tearDown
{
self.manager = nil;
self.validURL = nil;


__autoreleasing NSError *error;
[[NSFileManager defaultManager]removeItemAtPath:[NSString pathWithComponents:@[NSTemporaryDirectory(), pathToDownloadTests]]
error:&error];
[[NSFileManager defaultManager] removeItemAtPath:self.testsDirectory
error:&error];

XCTAssertNil(error, @"Error while removing tests directory - %@", error);

Expand Down Expand Up @@ -135,7 +138,7 @@ - (void)testCreateDownloadDirectory
{
NSString *testDirectory = [NSString pathWithComponents:@[self.manager.defaultDownloadPath, @"create_me"]];

/*[self.manager startDownloadWithURL:self.validURL
[self.manager startDownloadWithURL:self.validURL
customPath:testDirectory
firstResponse:^(NSURLResponse *response) {

Expand All @@ -149,7 +152,7 @@ - (void)testCreateDownloadDirectory
error:NULL
complete:NULL];

[self waitForStatus:XCTAsyncTestCaseStatusSucceeded timeout:5];*/
[self waitForStatus:XCTAsyncTestCaseStatusSucceeded timeout:5];

[self.manager startDownloadWithURL:self.validURL
customPath:testDirectory
Expand Down
4 changes: 1 addition & 3 deletions TCBlobDownloadExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
21D06E0F181847F400CAADCD /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 21D06E03181847F400CAADCD /* Default@2x.png */; };
21D06E10181847F400CAADCD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 21D06E04181847F400CAADCD /* InfoPlist.strings */; };
21D06E11181847F400CAADCD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 21D06E06181847F400CAADCD /* main.m */; };
21D06E12181847F400CAADCD /* TCBlobDownloadExample-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 21D06E07181847F400CAADCD /* TCBlobDownloadExample-Info.plist */; };
21D06E13181847F400CAADCD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21D06E0A181847F400CAADCD /* ViewController.m */; };
21D06E14181847F400CAADCD /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 21D06E0B181847F400CAADCD /* ViewController.xib */; };
21D06E2218184B3200CAADCD /* libTCBlobDownload.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D06E1D18184B1800CAADCD /* libTCBlobDownload.a */; };
Expand Down Expand Up @@ -180,7 +179,7 @@
2177622D1730025C001956C7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = thibaultCha;
TargetAttributes = {
217762341730025C001956C7 = {
Expand Down Expand Up @@ -238,7 +237,6 @@
21D06E0D181847F400CAADCD /* Default-568h@2x.png in Resources */,
21D06E0E181847F400CAADCD /* Default.png in Resources */,
21D06E14181847F400CAADCD /* ViewController.xib in Resources */,
21D06E12181847F400CAADCD /* TCBlobDownloadExample-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

0 comments on commit 25fd5b4

Please sign in to comment.