forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OmSessionStoreNameStrategyTest.class.st
82 lines (61 loc) · 1.86 KB
/
OmSessionStoreNameStrategyTest.class.st
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"
An OmSessionStoreNameStrategyTest is a test class for testing the behavior of OmSessionStoreNameStrategy
"
Class {
#name : #OmSessionStoreNameStrategyTest,
#superclass : #TestCase,
#instVars : [
'strategy',
'name'
],
#category : #'Ombu-Tests'
}
{ #category : #testing }
OmSessionStoreNameStrategyTest class >> isAbstract [
^ self name = #OmSessionStoreNameStrategyTest
]
{ #category : #private }
OmSessionStoreNameStrategyTest >> createFileWith: aName [
self directory ensureCreateDirectory.
(OmFileStore fileReferenceForStoreNamed: aName inDirectory: self directory)
writeStreamDo: [ :stream | stream print: 'stub contents' ]
]
{ #category : #private }
OmSessionStoreNameStrategyTest >> directory [
^ FileLocator temp asFileReference / 'ombu-strategy-tests'
]
{ #category : #private }
OmSessionStoreNameStrategyTest >> fileReferenceWith: aName [
^ OmFileStore
fileReferenceForStoreNamed: aName
inDirectory: self directory
]
{ #category : #running }
OmSessionStoreNameStrategyTest >> setUp [
super setUp.
strategy := self strategyClass new
]
{ #category : #initialization }
OmSessionStoreNameStrategyTest >> strategyClass [
^ self class environment classNamed:
(self class name allButLast: 4) "corresponding to the word Test"
]
{ #category : #running }
OmSessionStoreNameStrategyTest >> tearDown [
self directory ensureDeleteAll.
super tearDown
]
{ #category : #tests }
OmSessionStoreNameStrategyTest >> testWithExistingFile [
self createFileWith: 'existing'.
name := strategy nextTo: 'existing' in: self directory.
self assert: name isString.
self deny: name = 'existing'.
self deny: (self fileReferenceWith: name) exists
]
{ #category : #tests }
OmSessionStoreNameStrategyTest >> testWithNotExistingFile [
name := strategy nextTo: 'inexistent' in: self directory.
self assert: name isString.
self deny: (self fileReferenceWith: name) exists
]