 
       }
 
-      context("when a property value changes right after observing one") {
+      context("when a property value changes right after observing it") {
         // The difference between a property changing before or after observing is simply whether
         // an event is emitted or not.
 

              windowElement.attrs[.Main]    = true
              appElement.attrs[.MainWindow] = windowElement
              observer.emit(.MainWindowChanged, forElement: windowElement)
            }

            return initializeApp().then { appDelegate -> () in


/// Allows defining adversarial actions when an attribute is read.
class AdversaryWindowElement: TestWindowElement {
  var onRead: Optional<() -> ()> = nil
  var watchAttribute: Attribute? = nil
  var alreadyCalled = false

  /// Defines code that runs on the main thread before returning the value of the attribute.
  func onAttributeFirstRead(attribute: Attribute, handler: () -> ()) {
    watchAttribute = attribute
    onRead = handler
    alreadyCalled = false
  }

  override func attribute<T>(attribute: Attribute) throws -> T? {
    let result: T? = try super.attribute(attribute)
    if attribute == watchAttribute {
      performOnMainThread {
        if !self.alreadyCalled {
          self.onRead?()
          self.alreadyCalled = true
        }
      }
    }
    return result
  }
  override func getMultipleAttributes(attributes: [AXSwift.Attribute]) throws -> [Attribute : Any] {
    let result: [Attribute : Any] = try super.getMultipleAttributes(attributes)
    if let watchAttribute = watchAttribute where attributes.contains(watchAttribute) {
      performOnMainThread {
        if !self.alreadyCalled {
          self.onRead?()
          self.alreadyCalled = true
        }
      }
    }
    return result
  }
