I'm using Kiwi to test some classes and I need to stub a class method just to return a fake file path. I know that i can solve exposing some path property or create a subclass just for test, but i prefere to keep only one class and stub some methods.
this is the test:
it(@"return the full list of POS", ^(){
NSString *sample_data_path = [[NSBundle bundleForClass:[self class]] pathForResource:@"sample_pos" ofType:@"plist"];
Class p = [PointOfSale class];
[p stub:@selector(sampleDataPath) andReturn:sample_data_path];
NSArray *allPos = [p findAll];
[[theValue([allPos count]) should] equal:theValue(100)];
});
I'm confused because this test pass and fail alternatively, one success and one failure. There is not any "before_each"or other running test...
someone has the same issue?