forked from AlexDenisov/iActiveRecord
/
DropRecordSpec.mm
46 lines (40 loc) · 1.13 KB
/
DropRecordSpec.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// DropRecordSpec.mm
// iActiveRecord
//
// Created by Alex Denisov on 01.08.12.
// Copyright (c) 2012 CoreInvader. All rights reserved.
//
#import "Cedar-iOS/SpecHelper.h"
#import "User.h"
#import "ARDatabaseManager.h"
using namespace Cedar::Matchers;
SPEC_BEGIN(DropRecordSpecs)
beforeEach(^{
[[ARDatabaseManager sharedInstance] clearDatabase];
});
afterEach(^{
[[ARDatabaseManager sharedInstance] clearDatabase];
});
describe(@"Drop", ^{
it(@"dropRecord should remove record from database", ^{
NSString *username = @"Peter";
User *peter = [User newRecord];
peter.name = username;
[peter save];
NSInteger beforeCount = [User count];
[peter dropRecord];
NSInteger afterCount = [User count];
beforeCount should_not equal(afterCount);
});
it(@"dropAllRecord should remove al records from database", ^{
NSString *username = @"Peter";
User *peter = [User newRecord];
peter.name = username;
[peter save];
[User dropAllRecords];
NSInteger count = [User count];
count should equal(0);
});
});
SPEC_END