Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexdenisov/tsuga

Set of helpers for pivotal/cedar
https://github.com/alexdenisov/tsuga

Last synced: about 1 month ago
JSON representation

Set of helpers for pivotal/cedar

Awesome Lists containing this project

README

        

## [Tsuga](http://en.wikipedia.org/wiki/Tsuga) - set of [Cedar](https://github.com/pivotal/cedar) helpers

### Features

#### Spec definition

```cpp
CDR_EXT
Tsuga::run(^{
it(@"sample spec", ^{
YES should_not be_truthy;
});
});
```

#### Subject

```cpp
subject([User new]);

it(@"selector", ^{
subject() should responds_to(@selector(hello));
});

it(@"name", ^{
subject() should responds_to(@"hello");
});

```
#### 'should' shorthand

```cpp

beforeEach(^{
subject([User new]);
});

it(@"smth", ^{
ts_should responds_to(@selector(hello)); // subject() should responds_to(@selector(hello))
});
```

#### Context helpers

```cpp
ts_class(^{

it(@"", ^{
ts_should equal([User class]);
});

});

ts_instance(^{

it(@"", ^{
ts_should be_instance_of([User class]);
});

});
```

Expands to:

```cpp

context(@"class", ^{
beforeEach(^{
subject([SomeClass class]);
});

it(@"", ^{
ts_should equal([User class]);
});

});

context(@"instance", ^{
beforeEach(^{
subject([SomeClass new]);
});

it(@"", ^{
ts_should be_instance_of([User class]);
});

});
```

#### RespondsTo

```cpp
subject should responds_to(@selector(hello));
subject should responds_to(@"hello");
```

##### Shorthand

```cpp
responds(^{
to(@selector(fuu));
to(@selector(bar:));
to(@selector(bu:zz:));
});
```

#### ConformsTo

```cpp
subject should conforms_to(@protocol(Conformable));
subject should conforms_to(@"Conformable");
```

##### Shorthand

```cpp
conforms(^{
to(@protocol(UITableViewDelegate));
to(@protocol(PrintableObject));
});
```