Skip to content

Commit

Permalink
Update example project for Catbird 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Ignition committed Jun 6, 2020
1 parent f339237 commit 312bd24
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 52 deletions.
8 changes: 4 additions & 4 deletions Example/CatbirdX/CatbirdX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
0103207922C4BC08007077E5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0103207722C4BC08007077E5 /* Main.storyboard */; };
0103207B22C4BC09007077E5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0103207A22C4BC09007077E5 /* Assets.xcassets */; };
0103207E22C4BC09007077E5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0103207C22C4BC09007077E5 /* LaunchScreen.storyboard */; };
0103208922C4BC09007077E5 /* CatbirdXUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0103208822C4BC09007077E5 /* CatbirdXUITests.swift */; };
0103208922C4BC09007077E5 /* LoginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0103208822C4BC09007077E5 /* LoginTests.swift */; };
02A487C122CA06E300C4B5E6 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A487C022CA06E300C4B5E6 /* MainViewController.swift */; };
02A487CA22CA22B700C4B5E6 /* AuthService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A487C922CA22B700C4B5E6 /* AuthService.swift */; };
2DD73B7BB343A1C553A03A0F /* Pods_CatbirdXUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 087DABA571D7BB74702AE2A8 /* Pods_CatbirdXUITests.framework */; };
Expand All @@ -38,7 +38,7 @@
0103207D22C4BC09007077E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
0103207F22C4BC09007077E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0103208422C4BC09007077E5 /* CatbirdXUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CatbirdXUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
0103208822C4BC09007077E5 /* CatbirdXUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatbirdXUITests.swift; sourceTree = "<group>"; };
0103208822C4BC09007077E5 /* LoginTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginTests.swift; sourceTree = "<group>"; };
0103208A22C4BC09007077E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
02A487C022CA06E300C4B5E6 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
02A487C922CA22B700C4B5E6 /* AuthService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthService.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -108,7 +108,7 @@
0103208722C4BC09007077E5 /* CatbirdXUITests */ = {
isa = PBXGroup;
children = (
0103208822C4BC09007077E5 /* CatbirdXUITests.swift */,
0103208822C4BC09007077E5 /* LoginTests.swift */,
0103208A22C4BC09007077E5 /* Info.plist */,
);
path = CatbirdXUITests;
Expand Down Expand Up @@ -321,7 +321,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0103208922C4BC09007077E5 /* CatbirdXUITests.swift in Sources */,
0103208922C4BC09007077E5 /* LoginTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import XCTest
import Catbird

enum LoginMock: RequestBagConvertible {
enum LoginMock: CatbirdMockConvertible {
case success
case blockedUserError

var pattern: RequestPattern {
return RequestPattern.post(URL(string: "/login")!)
RequestPattern(method: .POST, url: "/login")
}

var responseData: ResponseData {
var response: ResponseMock {
switch self {
case .success:
let json: [String: Any] = [
Expand All @@ -19,9 +19,9 @@ enum LoginMock: RequestBagConvertible {
"expired_in": "123",
]
]
return ResponseData(
statusCode: 200,
headerFields: ["Content-Type": "application/json"],
return ResponseMock(
status: 200,
headers: ["Content-Type": "application/json"],
body: try! JSONSerialization.data(withJSONObject: json))

case .blockedUserError:
Expand All @@ -31,15 +31,15 @@ enum LoginMock: RequestBagConvertible {
"message": "user blocked"
]
]
return ResponseData(
statusCode: 400,
headerFields: ["Content-Type": "application/json"],
return ResponseMock(
status: 400,
headers: ["Content-Type": "application/json"],
body: try! JSONSerialization.data(withJSONObject: json))
}
}
}

final class LoginUITests: XCTestCase {
final class LoginTests: XCTestCase {

private let catbird = Catbird()
private var app: XCUIApplication!
Expand All @@ -55,7 +55,7 @@ final class LoginUITests: XCTestCase {
}

override func tearDown() {
XCTAssertNoThrow(try catbird.send(.clear), "Remove all requests")
XCTAssertNoThrow(try catbird.send(.removeAll), "Remove all mocks")
super.tearDown()
}

Expand Down
44 changes: 29 additions & 15 deletions Example/CatbirdX/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.11.1)
CFPropertyList (3.0.2)
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
algoliasearch (1.27.2)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.7.2)
claide (1.0.3)
cocoapods (1.9.3)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.7.2)
cocoapods-core (= 1.9.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
Expand All @@ -27,39 +30,50 @@ GEM
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.10.0, < 2.0)
cocoapods-core (1.7.2)
xcodeproj (>= 1.14.0, < 2.0)
cocoapods-core (1.9.3)
activesupport (>= 4.0.2, < 6)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-trunk (1.5.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
concurrent-ruby (1.1.6)
escape (0.0.4)
ethon (0.12.0)
ffi (>= 1.3.0)
ffi (1.13.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
json (2.3.0)
minitest (5.14.1)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
xcodeproj (1.10.0)
xcodeproj (1.16.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
2 changes: 1 addition & 1 deletion Example/CatbirdX/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ target 'CatbirdX' do
target 'CatbirdXUITests' do
inherit! :search_paths

pod 'Catbird'
pod 'Catbird', '0.8.0'
end
end
12 changes: 6 additions & 6 deletions Example/CatbirdX/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Catbird (0.5.0)
- Catbird (0.8.0)

DEPENDENCIES:
- Catbird
- Catbird (= 0.8.0)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
trunk:
- Catbird

SPEC CHECKSUMS:
Catbird: 897bfb654b31ef8a4998d2f38fc694e9686a5c9a
Catbird: 3d6fd9f9e10a07738deb201ec1987ccc5ca79aa0

PODFILE CHECKSUM: e59c98be217c159d1f082df0dfb3ec7546b925b0
PODFILE CHECKSUM: c6ca66b03511961a130822e9ace95268c894a935

COCOAPODS: 1.7.2
COCOAPODS: 1.9.3
44 changes: 29 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.11.1)
CFPropertyList (3.0.2)
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
algoliasearch (1.27.2)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.7.4)
claide (1.0.3)
cocoapods (1.9.3)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.7.4)
cocoapods-core (= 1.9.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
Expand All @@ -27,39 +30,50 @@ GEM
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.10.0, < 2.0)
cocoapods-core (1.7.4)
xcodeproj (>= 1.14.0, < 2.0)
cocoapods-core (1.9.3)
activesupport (>= 4.0.2, < 6)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-trunk (1.5.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
concurrent-ruby (1.1.6)
escape (0.0.4)
ethon (0.12.0)
ffi (>= 1.3.0)
ffi (1.13.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
json (2.3.0)
minitest (5.14.1)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
xcodeproj (1.11.0)
xcodeproj (1.16.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down

0 comments on commit 312bd24

Please sign in to comment.