This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum CustomMatcher { | |
case allOfsufficiently(id: String) | |
case displayLabel(text: String) | |
case displayButton(text: String) | |
var matcher: GREYMatcher { | |
switch self { | |
case let .allOfsufficiently(id): | |
return grey_allOf([grey_accessibilityID(id),grey_sufficientlyVisible()]) | |
case let .displayLabel(text): | |
return GREYElementMatcherBlock(matchesBlock: matchesBlock(text: text), descriptionBlock: describeBlock(text: text)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//테이블 cell 을 delete 하면 물품이 삭제 된다. | |
//expect : cell swipe -> (delete) row | |
func test_DeletePurchaseItem() { | |
let addButtonMatcher = grey_allOf([grey_accessibilityID("addButton"),grey_sufficientlyVisible()]) | |
EarlGrey.select(elementWithMatcher: addButtonMatcher).perform(grey_tap()) | |
EarlGrey.select(elementWithMatcher: CustomMatcher.allOfsufficiently(id: "PriceTextField").matcher).perform(grey_replaceText("300")) | |
EarlGrey.select(elementWithMatcher: CustomMatcher.allOfsufficiently(id: "PurchaseInputConfirm").matcher).perform(grey_tap()) | |
EarlGrey.select(elementWithMatcher: grey_accessibilityID("ListOfPurchasesViewController")).assert(grey_sufficientlyVisible()) | |
EarlGrey.select(elementWithMatcher: grey_text("$ 300")).perform(grey_swipeFastInDirectionWithStartPoint(.left, 0.3, 0.3)) | |
EarlGrey.select(elementWithMatcher: CustomMatcher.displayButton(text: "삭제").matcher).perform(grey_tap()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
target.build_configurations.each do |config| | |
config.build_settings['SWIFT_VERSION'] = '4.0' | |
config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CoverageTest { | |
func test1() { | |
func test2() { | |
print("test2") | |
} | |
test2() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Api { | |
static func getCurrencyExchangeRate(baseCurrency: String = "EUR", firebaseSaveBlock: ((Data) -> Void)? = nil) -> Single<[CurrencyExchangeRate]> { | |
return Service.shared.container | |
.resolve(MoyaProvider<CurrencyExchangeRateRemoteApi>.self)!.singleRequest(.exchangeRate(baseCurrency: baseCurrency)) | |
.observeOn(Service.shared.container.resolve(SerialDispatchQueueScheduler.self, name: Service.RegisterationName.cacheSave.rawValue)!) | |
.do(onSuccess: { firebaseSaveBlock?($0) }) | |
.map({ data -> [CurrencyExchangeRate] in | |
let exchangeRate = try JSONDecoder().decode(ExchangeRate.self, from: data) | |
return exchangeRate.convertCurrencyExchangeRate() | |
}).do(onSuccess: { rates in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CurrencyFirebaseDB { | |
var ref: DatabaseReference { get } | |
func getExchangeRate() -> Observable<[CurrencyExchangeRate]> | |
} | |
extension CurrencyFirebaseDB { | |
var ref: DatabaseReference { | |
return Service.shared.container.resolve(DatabaseReference.self, name: Service.RegisterationName.firebaseCurrencyExchageRate.rawValue)! | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol EstimatedTaxProtocol { | |
associatedtype ItemType: PurchaseItem | |
var items: BehaviorSubject<[ItemType]> { get set } | |
var sumData: Observable<Int> { get } | |
var estimatedTax: Observable<Int> { get } | |
var estimatedTaxItems: Observable<[ItemType]> { get } | |
} | |
extension EstimatedTaxProtocol { | |
var sumData: Observable<Int> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CurrencySelectedViewModel { | |
let currencyCellViewModels = BehaviorRelay<[CurrencyCellViewModel]>(value: []) | |
func selected(cellViewModel: CurrencyCellViewModel) { | |
} | |
func cancel() { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CurrencySelectedViewController { | |
func bindViewModel() { | |
self.viewModel.listOfCurrencyDatasource.bind(to: self.bindProperty.bindViewModels).disposed(by: disposeBag) | |
self.viewModel.databaseModelObservable.bind(to: self.viewModel.currencyCellViewModels).disposed(by: disposeBag) | |
self.bindDataSource(tableView: self.tableView) | |
//UI action | |
self.bindProperty.selectedCell.asObservable().map{ $0.1 }.subscribe(onNext: { [weak self] cellViewModel in | |
self?.viewModel.selected(cellViewModel: cellViewModel) | |
self?.view.generateFeedBack() | |
DispatchQueue.main.async { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CurrencySelectedViewModel_Tests: QuickSpec { | |
var viewModel: CurrencySelectedViewModel! | |
var disposeBag = DisposeBag() | |
override func spec() { | |
context("selected currecy"){ | |
beforeEach { | |
//DB 리셋등 초기화 | |
Realm.deleteAll(CurrencyExchangeRate.self) |
OlderNewer