Latest 0.1.0
Homepage https://github.com/attheodo/NSNotificationCenterMock
License MIT
Platforms ios 8.0, requires ARC
Authors

Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Then, navigate to NSNotificationCenterMock_ExampleTests/NSNotificationCenterMock_ExampleTests.swift and see how the test case utilises NSNotificationCenterMock to test the example app.

Installation

NSNotificationCenterMock is available through CocoaPods. To install
it, simply add the following line to your Podfile for your testing target:

target 'YourAppTests' do
    pod 'NSNotificationCenterMock'
end

Documentation

NSNotificationCenterMock provides the following public methods:

  • hasRegisteredNotificationName(name:_, withSelector:_) -> Bool
    • Returns whether an observer has been registered for NSNotification name with target selector withSelector.
  • hasNotificationBeenPosted(notificationName:_) -> Bool
    • Returns whether a NSNotification named notificationName has been posted.
  • timesNotificationPosted(notificationName:_) -> Int
    • Returns how many times a NSNotification named notificationName has been posted.
  • registeredNotifications() -> Int
    • Returns how many notification the observer has registered too.
  • hasRegisteredNotifications() -> Bool
    • Returns a boolean indicating whether the observer has registered to any notifications or not.

Author

attheodo, [email protected]

License

NSNotificationCenterMock is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "NSNotificationCenterMock",
    "version": "0.1.0",
    "summary": "A simple mock for NSNotificationCenter for easily testing NSNotificationCenter related tasks.",
    "description": "NSNotificationCenter is a class used for mocking NSNotificationCenter. You can use this class to testnNSNotification logic in your project such as whether certain NSNotifications were posted, registration/unregistrationnto/from observers and more.",
    "homepage": "https://github.com/attheodo/NSNotificationCenterMock",
    "license": "MIT",
    "authors": {
        "attheodo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/attheodo/NSNotificationCenterMock.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "NSNotificationCenterMock": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This