 @testable import Library
 
 final class LoginToutViewModelTests: XCTestCase {
+  let trackingClient = MockTrackingClient()
+  var vm: LoginToutViewModelType!
+
+  override func setUp() {
+    super.setUp()
+
+    let koala = Koala(client: trackingClient)
+
+    AppEnvironment.pushEnvironment(koala: koala)
+
+    vm = LoginToutViewModel()
+
+  }
+
+  override func tearDown() {
+    super.tearDown()
+
+    AppEnvironment.popEnvironment()
+  }
 
   func testKoala_whenLoginIntentBeforeViewAppears() {
-    let trackingClient = MockTrackingClient()
-    let koala = Koala(client: trackingClient)
+    vm.inputs.loginIntent(LoginIntent.Activity)
+    vm.inputs.viewDidAppear()
 
-    withEnvironment(koala: koala) {
-      let vm: LoginToutViewModelType = LoginToutViewModel()
+    XCTAssertEqual(["Application Login or Signup"], trackingClient.events)
 
-      vm.inputs.loginIntent(LoginIntent.Activity)
-      vm.inputs.viewDidAppear()
+    vm.inputs.viewDidAppear()
 
-      XCTAssertEqual(["Application Login or Signup"], trackingClient.events)
-
-      vm.inputs.viewDidAppear()
-
-      XCTAssertEqual(["Application Login or Signup"], trackingClient.events)
-    }
+    XCTAssertEqual(["Application Login or Signup"], trackingClient.events)
   }
 
   func testKoala_whenViewAppearsBeforeLoginIntent() {
-    let trackingClient = MockTrackingClient()
-    let koala = Koala(client: trackingClient)
+    vm.inputs.viewDidAppear()
+    vm.inputs.loginIntent(LoginIntent.Activity)
 
-    withEnvironment(koala: koala) {
-      let vm: LoginToutViewModelType = LoginToutViewModel()
-
-      vm.inputs.viewDidAppear()
-      vm.inputs.loginIntent(LoginIntent.Activity)
-
-      XCTAssertEqual(["Application Login or Signup"], trackingClient.events)
-    }
+    XCTAssertEqual(["Application Login or Signup"], trackingClient.events)
   }
 
   func testStartLogin() {
-    let vm: LoginToutViewModelType = LoginToutViewModel()
-
     let startLogin = TestObserver<(), NoError>()
     vm.outputs.startLogin.observe(startLogin.observer)
 

  }

  func testShowHelpType() {
    let vm: LoginToutViewModelType = LoginToutViewModel()

    let showHelp = TestObserver<HelpType, NoError>()
    vm.outputs.showHelp.observe(showHelp.observer)


  }

  func testShowHelpSheet() {
    let showHelpActionSheet = TestObserver<[HelpType], NoError>()
    vm.outputs.showHelpActionSheet.observe(showHelpActionSheet.observer)

