Skip to content

Commit eec9d16

Browse files
Merge pull request #746 from moosetechnology/745-add-withoutStubs-to-MooseModel
Fix #745: Add #withoutStubs to MooseAbstractGroup
2 parents f4794eb + 8e5a254 commit eec9d16

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

src/Moose-Core-Tests/MooseAbstractGroupTest.class.st

+23
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,29 @@ MooseAbstractGroupTest >> testWithIndexDo [
494494
self assertCollection: t hasSameElements: {{el1 . 1} . {el2 . 2} . {el3 . 3}}
495495
]
496496

497+
{ #category : #tests }
498+
MooseAbstractGroupTest >> testWithoutStubs [
499+
500+
| stubEntity1 stubEntity2 |
501+
502+
stubEntity1 := MooseEntity new
503+
isStub: true;
504+
yourself.
505+
stubEntity2 := MooseEntity new
506+
isStub: true;
507+
yourself.
508+
group
509+
add: MooseEntity new;
510+
add: MooseEntity new;
511+
add: stubEntity1;
512+
add: stubEntity2.
513+
514+
self assert: group size equals: 4.
515+
self assert: group withoutStubs isMooseObject.
516+
self assert: group withoutStubs size equals: 2.
517+
group withoutStubs do: [ :entity | self deny: entity isStub ]
518+
]
519+
497520
{ #category : #utilities }
498521
MooseAbstractGroupTest >> twoClasses [
499522
| classA classB |

src/Moose-Core/MooseAbstractGroup.class.st

+6
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,12 @@ MooseAbstractGroup >> withIndexDo: aBlockClosure [
786786
self entities withIndexDo: aBlockClosure
787787
]
788788

789+
{ #category : #accessing }
790+
MooseAbstractGroup >> withoutStubs [
791+
792+
^ (self reject: #isStub) asMooseGroup
793+
]
794+
789795
{ #category : #'set operations' }
790796
MooseAbstractGroup >> | aCollection [
791797
^ self union: aCollection

src/Moose-Core/MooseObject.class.st

+5
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ MooseObject >> isMooseModel [
358358
^ false
359359
]
360360

361+
{ #category : #testing }
362+
MooseObject >> isMooseObject [
363+
^ true
364+
]
365+
361366
{ #category : #testing }
362367
MooseObject >> isOfType: aClassFAMIX [
363368
^ self class isOfType: aClassFAMIX

src/Moose-Core/Object.extension.st

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ Object >> isMooseEntity [
2929
^ false
3030
]
3131

32+
{ #category : #'*Moose-Core' }
33+
Object >> isMooseObject [
34+
^ false
35+
]
36+
3237
{ #category : #'*Moose-Core' }
3338
Object class >> isOfType: aClassFAMIX [
3439
^ false

0 commit comments

Comments
 (0)