{"id":2082,"url":"https://github.com/specta/specta","last_synced_at":"2025-05-14T14:08:35.771Z","repository":{"id":2170134,"uuid":"3116607","full_name":"specta/specta","owner":"specta","description":"A light-weight TDD / BDD framework for Objective-C \u0026 Cocoa","archived":false,"fork":false,"pushed_at":"2022-02-27T13:22:51.000Z","size":1323,"stargazers_count":2322,"open_issues_count":18,"forks_count":214,"subscribers_count":63,"default_branch":"main","last_synced_at":"2025-05-13T14:41:40.307Z","etag":null,"topics":["bdd-framework","objective-c","testing","xcode"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/specta.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-06T08:15:03.000Z","updated_at":"2025-05-09T19:08:04.000Z","dependencies_parsed_at":"2022-08-28T20:11:20.263Z","dependency_job_id":null,"html_url":"https://github.com/specta/specta","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta%2Fspecta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta%2Fspecta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta%2Fspecta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta%2Fspecta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/specta","download_url":"https://codeload.github.com/specta/specta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254159836,"owners_count":22024564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd-framework","objective-c","testing","xcode"],"created_at":"2024-01-05T20:16:03.051Z","updated_at":"2025-05-14T14:08:35.745Z","avatar_url":"https://github.com/specta.png","language":"Objective-C","readme":"# Specta \n\nA light-weight TDD / BDD framework for Objective-C.\n\n## FEATURES\n\n* An Objective-C RSpec-like BDD DSL\n* Quick and easy set up\n* Built on top of XCTest\n* Excellent Xcode integration\n\n## SCREENSHOT\n\n\u003cimg src=\"https://raw.githubusercontent.com/specta/specta/master/misc/specta_screenshot.jpg\" width=\"100%\"\u003e\n\n## EXAMPLE\n\n```objective-c\n#import \u003cSpecta/Specta.h\u003e // #import \"Specta.h\" if you're using libSpecta.a\n\nSharedExamplesBegin(MySharedExamples)\n// Global shared examples are shared across all spec files.\n\nsharedExamplesFor(@\"foo\", ^(NSDictionary *data) {\n    __block id bar = nil;\n    beforeEach(^{\n        bar = data[@\"bar\"];\n    });\n    it(@\"should not be nil\", ^{\n        XCTAssertNotNil(bar);\n    });\n});\n\nSharedExamplesEnd\n\nSpecBegin(Thing)\n\ndescribe(@\"Thing\", ^{\n  sharedExamplesFor(@\"another shared behavior\", ^(NSDictionary *data) {\n    // Locally defined shared examples can override global shared examples within its scope.\n  });\n\n  beforeAll(^{\n    // This is run once and only once before all of the examples\n    // in this group and before any beforeEach blocks.\n  });\n\n  beforeEach(^{\n    // This is run before each example.\n  });\n\n  it(@\"should do stuff\", ^{\n    // This is an example block. Place your assertions here.\n  });\n\n  it(@\"should do some stuff asynchronously\", ^{\n    waitUntil(^(DoneCallback done) {\n      // Async example blocks need to invoke done() callback.\n      done();\n    });\n  });\n\n  itShouldBehaveLike(@\"a shared behavior\", @{@\"key\" : @\"obj\"});\n\n  itShouldBehaveLike(@\"another shared behavior\", ^{\n    // Use a block that returns a dictionary if you need the context to be evaluated lazily,\n    // e.g. to use an object prepared in a beforeEach block.\n    return @{@\"key\" : @\"obj\"};\n  });\n\n  describe(@\"Nested examples\", ^{\n    it(@\"should do even more stuff\", ^{\n      // ...\n    });\n  });\n\n  pending(@\"pending example\");\n\n  pending(@\"another pending example\", ^{\n    // ...\n  });\n\n  afterEach(^{\n    // This is run after each example.\n  });\n\n  afterAll(^{\n    // This is run once and only once after all of the examples\n    // in this group and after any afterEach blocks.\n  });\n});\n\nSpecEnd\n```\n\n* `beforeEach` and `afterEach` are also aliased as `before` and `after` respectively.\n* `describe` is also aliased as `context`.\n* `it` is also aliased as `example` and `specify`.\n* `itShouldBehaveLike` is also aliased as `itBehavesLike`.\n* Use `pending` or prepend `x` to `describe`, `context`, `example`, `it`, and `specify` to mark examples or groups as pending.\n* Use `^(DoneCallback done)` as shown in the example above to make examples wait for completion. `done()` callback needs to be invoked to let Specta know that your test is complete. The default timeout is 10.0 seconds but this can be changed by calling the function `setAsyncSpecTimeout(NSTimeInterval timeout)`.\n* `(before|after)(Each/All)` also accept `^(DoneCallback done)`s.\n* Do `#define SPT_CEDAR_SYNTAX` before importing Specta if you prefer to write `SPEC_BEGIN` and `SPEC_END` instead of `SpecBegin` and `SpecEnd`.\n* Prepend `f` to your `describe`, `context`, `example`, `it`, and `specify` to set focus on examples or groups. When specs are focused, all unfocused specs are skipped.\n* To use original XCTest reporter, set an environment variable named `SPECTA_REPORTER_CLASS` to `SPTXCTestReporter` in your test scheme.\n* Set an environment variable `SPECTA_SHUFFLE` with value `1` to enable test shuffling.\n* Set an environment variable `SPECTA_SEED` to specify the random seed for test shuffling.\n\nStandard XCTest matchers such as `XCTAssertEqualObjects` and `XCTAssertNil` work, but you probably want to add a nicer matcher framework - [Expecta](https://github.com/specta/expecta/) to your setup. Or if you really prefer, [OCHamcrest](https://github.com/hamcrest/OCHamcrest) works fine too. Also, add a mocking framework: [OCMock](http://ocmock.org/).\n\n## STATUS\n\nSpecta is considered a done project, there are no plans for _active_ development on the project at the moment aside from ensuring future Xcode compatability.\nTherefore it is a stable dependency, but will not be moving into the Swift world. If you are looking for that, we recommend you consider [Quick](https://github.com/quick/quick).\n\n## RUNNING SPECTA'S TESTS IN COMMAND LINE\n\n* Run `rake test` in the cloned folder.\n\n## CONTRIBUTION GUIDELINES\n\n* Please use only spaces and indent 2 spaces at a time.\n* Please prefix instance variable names with a single underscore (`_`).\n* Please prefix custom classes and functions defined in the global scope with `SPT`.\n\n## Installation\n\nUse [CocoaPods](https://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/carthage/carthage) or [Set up manually](#setting-up-manually)\n\n### CocoaPods\n\n1. Add Specta to your project's `Podfile`:\n\n```ruby\ntarget :MyApp do\n# your app dependencies\n\n  target :MyAppTests do\n    inherit! :search_paths\n\n    pod 'Specta', '~\u003e 2.0'\n    # pod 'Expecta',     '~\u003e 1.0'   # expecta matchers\n    # pod 'OCMock',      '~\u003e 2.2'   # OCMock\n    # pod 'OCHamcrest',  '~\u003e 3.0'   # hamcrest matchers\n    # pod 'OCMockito',   '~\u003e 1.0'   # OCMock\n    # pod 'LRMocky',     '~\u003e 0.9'   # LRMocky\n  end\nend\n```\n\n2. Run `pod install` in your project directory.\n\n### Carthage\n\n1. Add Specta to your project's `Cartfile.private`\n\n    ```\n    github \"specta/specta\" ~\u003e 2.0\n    ```\n\n2. Run `carthage update` in your project directory\n3. Drag the appropriate `Specta.framework` for your platform (located in Carthage/Build/) into your application’s Xcode project, and add it to your test target(s).\n4. If you are building for iOS, a new `Run Script Phase` must be added to copy the framework. The instructions can be found on [Carthage's getting started instructions](https://github.com/carthage/carthage#getting-started)\n\n### SETTING UP MANUALLY\n\n1. Clone from GitHub.\n2. Run `rake` in project root to build.\n3. Add a \"Cocoa/Cocoa Touch Unit Testing Bundle\" target if you don't already have one.\n4. Copy and add all header files in `Products` folder to the Test target in your Xcode project.\n5. For **OS X projects**, copy and add `Specta.framework` in `Products/osx` folder to the test target in your Xcode project.\n   For **iOS projects**, copy and add `Specta.framework` in `Products/ios` folder to the test target in your Xcode project.\n   You can alternatively use `libSpecta.a`, if you prefer to add it as a static library for your project. (iOS 7 and below require this)\n6. Add `-ObjC` and `-all_load` to the \"Other Linker Flags\" build setting for the test target in your Xcode project.\n7. If you encounter linking issues with `_llvm_*` symbols, ensure your target's \"Generate Test Coverage Files\" and \"Instrument Program Flow\" build settings are set to `Yes`.\n\n## LICENSE\n\nCopyright (c) 2012-2022 [Specta Team](https://github.com/orgs/specta/people). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).\n","funding_links":[],"categories":["Testing","Uncategorized","Objective-C","xcode","**Index**","Tools"],"sub_categories":["TDD / BDD","Uncategorized","Other free courses","First, the gold standard libraries. The essentials --- You **NEED** to know about these !! You're likely to include a few of these in your own iOS projects","Objective-C"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecta%2Fspecta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspecta%2Fspecta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecta%2Fspecta/lists"}