- Fix present picker controller
This commit is contained in:
1 parent
2aa49f6ad1
commit
5974642e25
277 files changed
+14514
-11692
No files matched your search
Generated
+62
-59
@@ -1,11 +1,7 @@
|
||||
# Specta
|
||||
# Specta [](https://travis-ci.org/specta/specta) [](https://coveralls.io/r/specta/specta)
|
||||
|
||||
A light-weight TDD / BDD framework for Objective-C.
|
||||
|
||||
### Status
|
||||
[](https://travis-ci.org/specta/specta)
|
||||
[](https://coveralls.io/r/specta/specta)
|
||||
|
||||
## FEATURES
|
||||
|
||||
* An Objective-C RSpec-like BDD DSL
|
||||
@@ -15,56 +11,7 @@ A light-weight TDD / BDD framework for Objective-C.
|
||||
|
||||
## SCREENSHOT
|
||||
|
||||

|
||||
|
||||
## SETUP
|
||||
|
||||
Use [CocoaPods](http://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/carthage/carthage) or [Set up manually](#setting-up-manually)
|
||||
|
||||
### CocoaPods
|
||||
|
||||
1. Add Specta to your project's `Podfile`:
|
||||
|
||||
```ruby
|
||||
target :MyApp do
|
||||
# your app dependencies
|
||||
end
|
||||
|
||||
target :MyAppTests do
|
||||
pod 'Specta', '~> 1.0'
|
||||
# pod 'Expecta', '~> 1.0' # expecta matchers
|
||||
# pod 'OCMock', '~> 2.2' # OCMock
|
||||
# pod 'OCHamcrest', '~> 3.0' # hamcrest matchers
|
||||
# pod 'OCMockito', '~> 1.0' # OCMock
|
||||
# pod 'LRMocky', '~> 0.9' # LRMocky
|
||||
end
|
||||
```
|
||||
|
||||
2. Run `pod update` or `pod install` in your project directory.
|
||||
|
||||
### Carthage
|
||||
|
||||
1. Add Specta to your project's `Cartfile.private`
|
||||
|
||||
```
|
||||
github "specta/specta" ~> 1.0
|
||||
```
|
||||
|
||||
2. Run `carthage update` in your project directory
|
||||
3. 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).
|
||||
4. 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)
|
||||
|
||||
### SETTING UP MANUALLY
|
||||
|
||||
1. Clone from Github.
|
||||
2. Run `rake` in project root to build.
|
||||
3. Add a "Cocoa/Cocoa Touch Unit Testing Bundle" target if you don't already have one.
|
||||
4. Copy and add all header files in `Products` folder to the Test target in your Xcode project.
|
||||
5. For **OS X projects**, copy and add `Specta.framework` in `Products/osx` folder to the test target in your Xcode project.
|
||||
For **iOS projects**, copy and add `Specta.framework` in `Products/ios` folder to the test target in your Xcode project.
|
||||
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)
|
||||
6. Add `-ObjC` and `-all_load` to the "Other Linker Flags" build setting for the test target in your Xcode project.
|
||||
7. 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`.
|
||||
<img src="https://raw.githubusercontent.com/specta/specta/master/misc/specta_screenshot.jpg" width="100%">
|
||||
|
||||
## EXAMPLE
|
||||
|
||||
@@ -156,12 +103,17 @@ SpecEnd
|
||||
* Do `#define SPT_CEDAR_SYNTAX` before importing Specta if you prefer to write `SPEC_BEGIN` and `SPEC_END` instead of `SpecBegin` and `SpecEnd`.
|
||||
* 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.
|
||||
* To use original XCTest reporter, set an environment variable named `SPECTA_REPORTER_CLASS` to `SPTXCTestReporter` in your test scheme.
|
||||
* Set an environment variable `SPECTA_NO_SHUFFLE` with value `1` to disable test shuffling.
|
||||
* Set an environment variable `SPECTA_SHUFFLE` with value `1` to enable test shuffling.
|
||||
* Set an environment variable `SPECTA_SEED` to specify the random seed for test shuffling.
|
||||
|
||||
Standard XCTest matchers such as `XCTAssertEqualObjects` and `XCTAssertNil` work, but you probably want to add a nicer matcher framework - [Expecta](http://github.com/specta/expecta/) to your setup. Or if you really prefer, [OCHamcrest](https://github.com/jonreid/OCHamcrest) works fine too. Also, add a mocking framework: [OCMock](http://ocmock.org/).
|
||||
Standard 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/).
|
||||
|
||||
## RUNNING TESTS IN COMMAND LINE
|
||||
## STATUS
|
||||
|
||||
Specta is considered a done project, there are no plans for _active_ development on the project at the moment aside from ensuring future Xcode compatability.
|
||||
Therefore 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).
|
||||
|
||||
## RUNNING SPECTA'S TESTS IN COMMAND LINE
|
||||
|
||||
* Run `rake test` in the cloned folder.
|
||||
|
||||
@@ -171,6 +123,57 @@ Standard XCTest matchers such as `XCTAssertEqualObjects` and `XCTAssertNil` work
|
||||
* Please prefix instance variable names with a single underscore (`_`).
|
||||
* Please prefix custom classes and functions defined in the global scope with `SPT`.
|
||||
|
||||
## Installation
|
||||
|
||||
Use [CocoaPods](https://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/carthage/carthage) or [Set up manually](#setting-up-manually)
|
||||
|
||||
### CocoaPods
|
||||
|
||||
1. Add Specta to your project's `Podfile`:
|
||||
|
||||
```ruby
|
||||
target :MyApp do
|
||||
# your app dependencies
|
||||
|
||||
target :MyAppTests do
|
||||
inherit! :search_paths
|
||||
|
||||
pod 'Specta', '~> 1.0'
|
||||
# pod 'Expecta', '~> 1.0' # expecta matchers
|
||||
# pod 'OCMock', '~> 2.2' # OCMock
|
||||
# pod 'OCHamcrest', '~> 3.0' # hamcrest matchers
|
||||
# pod 'OCMockito', '~> 1.0' # OCMock
|
||||
# pod 'LRMocky', '~> 0.9' # LRMocky
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
2. Run `pod install` in your project directory.
|
||||
|
||||
### Carthage
|
||||
|
||||
1. Add Specta to your project's `Cartfile.private`
|
||||
|
||||
```
|
||||
github "specta/specta" ~> 1.0
|
||||
```
|
||||
|
||||
2. Run `carthage update` in your project directory
|
||||
3. 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).
|
||||
4. 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)
|
||||
|
||||
### SETTING UP MANUALLY
|
||||
|
||||
1. Clone from Github.
|
||||
2. Run `rake` in project root to build.
|
||||
3. Add a "Cocoa/Cocoa Touch Unit Testing Bundle" target if you don't already have one.
|
||||
4. Copy and add all header files in `Products` folder to the Test target in your Xcode project.
|
||||
5. For **OS X projects**, copy and add `Specta.framework` in `Products/osx` folder to the test target in your Xcode project.
|
||||
For **iOS projects**, copy and add `Specta.framework` in `Products/ios` folder to the test target in your Xcode project.
|
||||
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)
|
||||
6. Add `-ObjC` and `-all_load` to the "Other Linker Flags" build setting for the test target in your Xcode project.
|
||||
7. 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`.
|
||||
|
||||
## LICENSE
|
||||
|
||||
Copyright (c) 2012-2015 [Specta Team](https://github.com/specta?tab=members). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
|
||||
Copyright (c) 2012-2016 [Specta Team](https://github.com/orgs/specta/people). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
|
||||
+2
-1
@@ -19,7 +19,7 @@
|
||||
[spec spec];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
fprintf(stderr, "%s: An exception has occured outside of tests, aborting.\n\n%s (%s) \n", [specName UTF8String], [[exception name] UTF8String], [[exception reason] UTF8String]);
|
||||
fprintf(stderr, "%s: An exception has occurred outside of tests, aborting.\n\n%s (%s) \n", [specName UTF8String], [[exception name] UTF8String], [[exception reason] UTF8String]);
|
||||
if ([exception respondsToSelector:@selector(callStackSymbols)]) {
|
||||
NSArray *callStackSymbols = [exception callStackSymbols];
|
||||
if (callStackSymbols) {
|
||||
@@ -145,6 +145,7 @@
|
||||
example.block(self);
|
||||
} else if (!example.pending) {
|
||||
self.spt_skipped = YES;
|
||||
NSLog(@"Skipping '%@'", example.name);
|
||||
}
|
||||
|
||||
[[[NSThread currentThread] threadDictionary] removeObjectForKey:spt_kCurrentSpecKey];
|
||||
|
||||
+20
-20
@@ -10,20 +10,20 @@
|
||||
|
||||
typedef void (^DoneCallback)(void);
|
||||
|
||||
OBJC_EXTERN void describe(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void fdescribe(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void describe(NSString *name, void (^block)(void));
|
||||
OBJC_EXTERN void fdescribe(NSString *name, void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void context(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void fcontext(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void context(NSString *name, void (^block)(void));
|
||||
OBJC_EXTERN void fcontext(NSString *name, void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void it(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void fit(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void it(NSString *name, void (^block)(void));
|
||||
OBJC_EXTERN void fit(NSString *name, void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void example(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void fexample(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void example(NSString *name, void (^block)(void));
|
||||
OBJC_EXTERN void fexample(NSString *name, void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void specify(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void fspecify(NSString *name, void (^block)());
|
||||
OBJC_EXTERN void specify(NSString *name, void (^block)(void));
|
||||
OBJC_EXTERN void fspecify(NSString *name, void (^block)(void));
|
||||
|
||||
#define pending(...) spt_pending_(__VA_ARGS__, nil)
|
||||
#define xdescribe(...) spt_pending_(__VA_ARGS__, nil)
|
||||
@@ -32,14 +32,14 @@ OBJC_EXTERN void fspecify(NSString *name, void (^block)());
|
||||
#define xit(...) spt_pending_(__VA_ARGS__, nil)
|
||||
#define xspecify(...) spt_pending_(__VA_ARGS__, nil)
|
||||
|
||||
OBJC_EXTERN void beforeAll(void (^block)());
|
||||
OBJC_EXTERN void afterAll(void (^block)());
|
||||
OBJC_EXTERN void beforeAll(void (^block)(void));
|
||||
OBJC_EXTERN void afterAll(void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void beforeEach(void (^block)());
|
||||
OBJC_EXTERN void afterEach(void (^block)());
|
||||
OBJC_EXTERN void beforeEach(void (^block)(void));
|
||||
OBJC_EXTERN void afterEach(void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void before(void (^block)());
|
||||
OBJC_EXTERN void after(void (^block)());
|
||||
OBJC_EXTERN void before(void (^block)(void));
|
||||
OBJC_EXTERN void after(void (^block)(void));
|
||||
|
||||
OBJC_EXTERN void sharedExamplesFor(NSString *name, void (^block)(NSDictionary *data));
|
||||
OBJC_EXTERN void sharedExamples(NSString *name, void (^block)(NSDictionary *data));
|
||||
@@ -54,7 +54,7 @@ OBJC_EXTERN void waitUntil(void (^block)(DoneCallback done));
|
||||
*
|
||||
* @param timeout timeout for this @c block only; does not affect the global
|
||||
* timeout, as @c setAsyncSpecTimeout() does.
|
||||
* @param ^block runs test code
|
||||
* @param block runs test code
|
||||
*/
|
||||
OBJC_EXTERN void waitUntilTimeout(NSTimeInterval timeout, void (^block)(DoneCallback done));
|
||||
|
||||
@@ -83,8 +83,8 @@ OBJC_EXTERN void setAsyncSpecTimeout(NSTimeInterval timeout);
|
||||
} \
|
||||
@end
|
||||
|
||||
OBJC_EXTERN void spt_it_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)());
|
||||
OBJC_EXTERN void spt_fit_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)());
|
||||
OBJC_EXTERN void spt_it_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)(void));
|
||||
OBJC_EXTERN void spt_fit_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)(void));
|
||||
OBJC_EXTERN void spt_pending_(NSString *name, ...);
|
||||
OBJC_EXTERN void spt_itShouldBehaveLike_(NSString *fileName, NSUInteger lineNumber, NSString *name, id dictionaryOrBlock);
|
||||
OBJC_EXTERN void spt_itShouldBehaveLike_block(NSString *fileName, NSUInteger lineNumber, NSString *name, NSDictionary *(^block)());
|
||||
OBJC_EXTERN void spt_itShouldBehaveLike_block(NSString *fileName, NSUInteger lineNumber, NSString *name, NSDictionary *(^block)(void));
|
||||
+4
-1
@@ -52,12 +52,15 @@ void spt_itShouldBehaveLike_(NSString *fileName, NSUInteger lineNumber, NSString
|
||||
|
||||
beforeEach(^{
|
||||
NSDictionary *blockData = dataBlock();
|
||||
[dataDict removeAllObjects];
|
||||
[dataDict addEntriesFromDictionary:blockData];
|
||||
});
|
||||
|
||||
block(dataDict);
|
||||
|
||||
afterEach(^{
|
||||
[dataDict removeAllObjects];
|
||||
});
|
||||
|
||||
afterAll(^{
|
||||
dataDict = nil;
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@class SPTSpec;
|
||||
|
||||
typedef void (^SPTVoidBlock)();
|
||||
typedef void (^SPTVoidBlock)(void);
|
||||
typedef void (^SPTSpecBlock)(SPTSpec *spec);
|
||||
typedef void (^SPTDictionaryBlock)(NSDictionary *dictionary);
|
||||
+1
-1
@@ -15,4 +15,4 @@ BOOL spt_isSpecClass(Class aClass);
|
||||
NSString *spt_underscorize(NSString *string);
|
||||
NSArray *spt_map(NSArray *array, id (^block)(id obj, NSUInteger idx));
|
||||
NSArray *spt_shuffle(NSArray *array);
|
||||
unsigned int spt_seed();
|
||||
unsigned int spt_seed(void);
|
||||
+4
-1
@@ -42,7 +42,10 @@
|
||||
[self spt_dequeueFailures];
|
||||
};
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
BOOL isMainThread = [NSThread isMainThread];
|
||||
BOOL isSpectaTest = [self isKindOfClass:[SPTSpec class]];
|
||||
|
||||
if (!isSpectaTest || isMainThread) {
|
||||
dequeueFailures();
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), dequeueFailures);
|
||||
|
||||
Reference in new issue
Block a user