杉木 0.0.8

杉木 0.0.8

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2014年12月

AlexDenisov维护。



杉木 0.0.8

  • Alex Denisov

杉木 - 一组Cedar辅助函数

特性

Spec定义

CDR_EXT
Tsuga<Sample>::run(^{
    it(@"sample spec", ^{
        YES should_not be_truthy;
    });
});

主题

subject([User new]);

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

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

'should'简写

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

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

上下文辅助函数

ts_class(^{

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

});

ts_instance(^{

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

});

展开为

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

subject should responds_to(@selector(hello));
subject should responds_to(@"hello");
简写
responds(^{
    to(@selector(fuu));
    to(@selector(bar:));
    to(@selector(bu:zz:));
});

ConformsTo

subject should conforms_to(@protocol(Conformable));
subject should conforms_to(@"Conformable");
简写
conforms(^{
    to(@protocol(UITableViewDelegate));
    to(@protocol(PrintableObject));
});