Skip to content

Commit 4df264e

Browse files
authored
Merge pull request #39 from ba-st/pluggable-user-story-test
Added PluggableUserStoryTest
2 parents 7c62f8f + 14fbab4 commit 4df264e

File tree

2 files changed

+48
-11
lines changed

2 files changed

+48
-11
lines changed

source/Kepler-Notifications-Tests/EventNotificationModuleTest.class.st

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ An EventNotificationModuleTest is a test class for testing the behavior of Event
33
"
44
Class {
55
#name : #EventNotificationModuleTest,
6-
#superclass : #SystemBasedUserStoryTest,
6+
#superclass : #TestCase,
7+
#instVars : [
8+
'userStory'
9+
],
710
#category : #'Kepler-Notifications-Tests'
811
}
912

1013
{ #category : #'private - accessing' }
1114
EventNotificationModuleTest >> installedModuleRegistrationSystem [
1215

13-
^ rootSystem >> #InstalledModuleRegistrationSystem
16+
^ userStory rootSystem >> #InstalledModuleRegistrationSystem
1417
]
1518

16-
{ #category : #'private - configuring' }
17-
EventNotificationModuleTest >> requireEventNotificationModule [
19+
{ #category : #running }
20+
EventNotificationModuleTest >> setUp [
1821

19-
self requireInstallationOf: EventNotificationModule
20-
]
21-
22-
{ #category : #'private - running' }
23-
EventNotificationModuleTest >> setUpRequirements [
24-
25-
self requireEventNotificationModule
22+
super setUp.
23+
userStory := PluggableUserStoryTest
24+
requiring: [ :test | test requireInstallationOf: EventNotificationModule ].
25+
userStory setUp
2626
]
2727

2828
{ #category : #tests }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"
2+
I'm a kind of configurable user story test.
3+
My intention is to be used in composition relations with other tests that cannot subclass directly SystemBasedUserStoryTest.
4+
The users just need to provide a block configuring the requirements.
5+
"
6+
Class {
7+
#name : #PluggableUserStoryTest,
8+
#superclass : #SystemBasedUserStoryTest,
9+
#instVars : [
10+
'requirementSetUp'
11+
],
12+
#category : #'Kepler-SUnit-Model'
13+
}
14+
15+
{ #category : #'instance creation' }
16+
PluggableUserStoryTest class >> requiring: aRequirementSetUpBlock [
17+
18+
^self new initializeRequiring: aRequirementSetUpBlock
19+
]
20+
21+
{ #category : #initialization }
22+
PluggableUserStoryTest >> initializeRequiring: aRequirementSetUpBlock [
23+
24+
requirementSetUp := aRequirementSetUpBlock
25+
]
26+
27+
{ #category : #accessing }
28+
PluggableUserStoryTest >> rootSystem [
29+
30+
^ rootSystem
31+
]
32+
33+
{ #category : #'private - running' }
34+
PluggableUserStoryTest >> setUpRequirements [
35+
36+
requirementSetUp value: self
37+
]

0 commit comments

Comments
 (0)