From 42dbd55835216c497475482686c0685b70d65d00 Mon Sep 17 00:00:00 2001 From: Alexey Kuznetsov Date: Tue, 15 Mar 2016 17:31:53 +0100 Subject: [PATCH] Shorter factory method name for RingtoneSoundNameSaveInteractor Issue #161 --- Telephone/DefaultInteractorFactory.swift | 2 +- Telephone/SoundPreferencesViewEventHandler.swift | 2 +- TelephoneTests/DefaultInteractorFactoryTests.swift | 4 ++-- .../SoundPreferencesViewEventHandlerTests.swift | 6 +++--- UseCases/InteractorFactory.swift | 2 +- UseCasesTestDoubles/InteractorFactorySpy.swift | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Telephone/DefaultInteractorFactory.swift b/Telephone/DefaultInteractorFactory.swift index 7ecc17bf7..21f7509ff 100644 --- a/Telephone/DefaultInteractorFactory.swift +++ b/Telephone/DefaultInteractorFactory.swift @@ -48,7 +48,7 @@ extension DefaultInteractorFactory: InteractorFactory { return UserDefaultsSoundIOSaveInteractor(soundIO: soundIO, userDefaults: userDefaults) } - func createUserDefaultsRingtoneSoundNameSaveInteractor(name name: String) -> Interactor { + func createRingtoneSoundNameSaveInteractor(name name: String) -> Interactor { return UserDefaultsRingtoneSoundNameSaveInteractor(soundName: name, userDefaults: userDefaults) } } diff --git a/Telephone/SoundPreferencesViewEventHandler.swift b/Telephone/SoundPreferencesViewEventHandler.swift index 278d2bcb1..8cd802c94 100644 --- a/Telephone/SoundPreferencesViewEventHandler.swift +++ b/Telephone/SoundPreferencesViewEventHandler.swift @@ -56,7 +56,7 @@ extension SoundPreferencesViewEventHandler: SoundPreferencesViewObserver { } func viewDidChangeRingtoneName(name: String) { - interactorFactory.createUserDefaultsRingtoneSoundNameSaveInteractor(name: name).execute() + interactorFactory.createRingtoneSoundNameSaveInteractor(name: name).execute() playRingtoneSoundOrLogError() } diff --git a/TelephoneTests/DefaultInteractorFactoryTests.swift b/TelephoneTests/DefaultInteractorFactoryTests.swift index f944a8e92..67382ba3a 100644 --- a/TelephoneTests/DefaultInteractorFactoryTests.swift +++ b/TelephoneTests/DefaultInteractorFactoryTests.swift @@ -63,8 +63,8 @@ class DefaultInteractorFactoryTests: XCTestCase { XCTAssertTrue(result.userDefaults === userDefaults) } - func testCanCreateUserDefaultsRingtoneSoundNameSaveInteractor() { - let result = sut.createUserDefaultsRingtoneSoundNameSaveInteractor(name: "sound-name") as! UserDefaultsRingtoneSoundNameSaveInteractor + func testCanCreateRingtoneSoundNameSaveInteractor() { + let result = sut.createRingtoneSoundNameSaveInteractor(name: "sound-name") as! UserDefaultsRingtoneSoundNameSaveInteractor XCTAssertNotNil(result) XCTAssertEqual(result.soundName, "sound-name") diff --git a/TelephoneTests/SoundPreferencesViewEventHandlerTests.swift b/TelephoneTests/SoundPreferencesViewEventHandlerTests.swift index e6c2d0c7b..1df92b753 100644 --- a/TelephoneTests/SoundPreferencesViewEventHandlerTests.swift +++ b/TelephoneTests/SoundPreferencesViewEventHandlerTests.swift @@ -80,9 +80,9 @@ class SoundPreferencesViewEventHandlerTests: XCTestCase { XCTAssertTrue(ringtoneOutputUpdateInteractorSpy.didCallExecute) } - func testExecutesUserDefaultsRingtoneSoundNameSaveInteractorWithExpectedArgumentsOnRingtoneNameChange() { + func testExecutesRingtoneSoundNameSaveInteractorWithExpectedArgumentsOnRingtoneNameChange() { let interactorSpy = InteractorSpy() - interactorFactorySpy.stubWithUserDefaultsRingtoneSoundNameSaveInteractor(interactorSpy) + interactorFactorySpy.stubWithRingtoneSoundNameSaveInteractor(interactorSpy) sut.viewDidChangeRingtoneName("sound-name") @@ -91,7 +91,7 @@ class SoundPreferencesViewEventHandlerTests: XCTestCase { } func testPlaysRingtoneSoundOnRingtoneNameChange() { - interactorFactorySpy.stubWithUserDefaultsRingtoneSoundNameSaveInteractor(InteractorSpy()) + interactorFactorySpy.stubWithRingtoneSoundNameSaveInteractor(InteractorSpy()) sut.viewDidChangeRingtoneName("any-name") diff --git a/UseCases/InteractorFactory.swift b/UseCases/InteractorFactory.swift index 63b794280..52920a372 100644 --- a/UseCases/InteractorFactory.swift +++ b/UseCases/InteractorFactory.swift @@ -19,5 +19,5 @@ public protocol InteractorFactory { func createUserAgentSoundIOSelectionInteractor(userAgent userAgent: UserAgent) -> ThrowingInteractor func createUserDefaultsSoundIOLoadInteractor(output output: UserDefaultsSoundIOLoadInteractorOutput) -> ThrowingInteractor func createUserDefaultsSoundIOSaveInteractor(soundIO soundIO: SoundIO) -> Interactor - func createUserDefaultsRingtoneSoundNameSaveInteractor(name name: String) -> Interactor + func createRingtoneSoundNameSaveInteractor(name name: String) -> Interactor } diff --git a/UseCasesTestDoubles/InteractorFactorySpy.swift b/UseCasesTestDoubles/InteractorFactorySpy.swift index 9999298c5..052108e72 100644 --- a/UseCasesTestDoubles/InteractorFactorySpy.swift +++ b/UseCasesTestDoubles/InteractorFactorySpy.swift @@ -21,7 +21,7 @@ public class InteractorFactorySpy { public private(set) var userAgentSoundIOSelectionInteractor: ThrowingInteractor! public private(set) var userDefaultsSoundIOLoadInteractor: ThrowingInteractor! public private(set) var userDefaultsSoundIOSaveInteractor: Interactor! - public private(set) var userDefaultsRingtoneSoundNameSaveInteractor: Interactor! + public private(set) var ringtoneSoundNameSaveInteractor: Interactor! public private(set) var invokedSoundIO = SoundIO(soundInput: "", soundOutput: "", ringtoneOutput: "") public private(set) var invokedRingtoneSoundName = "" @@ -40,8 +40,8 @@ public class InteractorFactorySpy { userDefaultsSoundIOSaveInteractor = interactor } - public func stubWithUserDefaultsRingtoneSoundNameSaveInteractor(interactor: Interactor) { - userDefaultsRingtoneSoundNameSaveInteractor = interactor + public func stubWithRingtoneSoundNameSaveInteractor(interactor: Interactor) { + ringtoneSoundNameSaveInteractor = interactor } } @@ -59,8 +59,8 @@ extension InteractorFactorySpy: InteractorFactory { return userDefaultsSoundIOSaveInteractor } - public func createUserDefaultsRingtoneSoundNameSaveInteractor(name name: String) -> Interactor { + public func createRingtoneSoundNameSaveInteractor(name name: String) -> Interactor { invokedRingtoneSoundName = name - return userDefaultsRingtoneSoundNameSaveInteractor + return ringtoneSoundNameSaveInteractor } }