Skip to content

Commit

Permalink
Merge pull request #39 from ba-st/pluggable-user-story-test
Browse files Browse the repository at this point in the history
Added PluggableUserStoryTest
  • Loading branch information
gcotelli authored Oct 3, 2019
2 parents 7c62f8f + 14fbab4 commit 4df264e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ An EventNotificationModuleTest is a test class for testing the behavior of Event
"
Class {
#name : #EventNotificationModuleTest,
#superclass : #SystemBasedUserStoryTest,
#superclass : #TestCase,
#instVars : [
'userStory'
],
#category : #'Kepler-Notifications-Tests'
}

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

^ rootSystem >> #InstalledModuleRegistrationSystem
^ userStory rootSystem >> #InstalledModuleRegistrationSystem
]

{ #category : #'private - configuring' }
EventNotificationModuleTest >> requireEventNotificationModule [
{ #category : #running }
EventNotificationModuleTest >> setUp [

self requireInstallationOf: EventNotificationModule
]

{ #category : #'private - running' }
EventNotificationModuleTest >> setUpRequirements [

self requireEventNotificationModule
super setUp.
userStory := PluggableUserStoryTest
requiring: [ :test | test requireInstallationOf: EventNotificationModule ].
userStory setUp
]

{ #category : #tests }
Expand Down
37 changes: 37 additions & 0 deletions source/Kepler-SUnit-Model/PluggableUserStoryTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"
I'm a kind of configurable user story test.
My intention is to be used in composition relations with other tests that cannot subclass directly SystemBasedUserStoryTest.
The users just need to provide a block configuring the requirements.
"
Class {
#name : #PluggableUserStoryTest,
#superclass : #SystemBasedUserStoryTest,
#instVars : [
'requirementSetUp'
],
#category : #'Kepler-SUnit-Model'
}

{ #category : #'instance creation' }
PluggableUserStoryTest class >> requiring: aRequirementSetUpBlock [

^self new initializeRequiring: aRequirementSetUpBlock
]

{ #category : #initialization }
PluggableUserStoryTest >> initializeRequiring: aRequirementSetUpBlock [

requirementSetUp := aRequirementSetUpBlock
]

{ #category : #accessing }
PluggableUserStoryTest >> rootSystem [

^ rootSystem
]

{ #category : #'private - running' }
PluggableUserStoryTest >> setUpRequirements [

requirementSetUp value: self
]

0 comments on commit 4df264e

Please sign in to comment.