--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CustomSubContextTests.st Wed Nov 19 20:52:39 2014 +0100
@@ -0,0 +1,62 @@
+"{ Package: 'jn:refactoring_custom' }"
+
+TestCase subclass:#CustomSubContextTests
+ instanceVariableNames:'model context'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Refactoring-Custom-Tests'
+!
+
+!CustomSubContextTests methodsFor:'initialization & release'!
+
+setUp
+ super setUp.
+
+ model := CustomNamespace new.
+ context := CustomSubContext new
+ model: model;
+ yourself
+
+ "Modified: / 19-11-2014 / 19:59:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomSubContextTests methodsFor:'tests'!
+
+test_selected_methods_as_rb_method
+
+ |expectedMethods realMethod actualMethods modelClass modelMethod|
+
+ modelClass := model classNamed: self class name.
+ modelMethod := modelClass compiledMethodAt: #test_selected_methods_as_rb_method.
+ expectedMethods := Array with: modelMethod.
+
+ realMethod := self class compiledMethodAt: #test_selected_methods_as_rb_method.
+ context selectedMethods: (Array with: realMethod).
+ actualMethods := context selectedMethods.
+
+ "Cannot test coolection equality, because each contains different RBMethod instance
+ self assert: expectedMethods = actualMethods"
+ self assert: (expectedMethods size) = (actualMethods size).
+ self assert: (expectedMethods first selector) = (actualMethods first selector).
+ self assert: (expectedMethods first isKindOf: RBMethod).
+ self deny: expectedMethods first isMethod
+
+ "Modified: / 19-11-2014 / 20:29:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_selected_methods_existing_rb_method
+
+ |expectedMethods actualMethods modelClass modelMethod|
+
+ modelClass := model classNamed: self class name.
+ modelMethod := modelClass compiledMethodAt: #test_selected_methods_as_rb_method.
+ expectedMethods := Array with: modelMethod.
+
+ context selectedMethods: (Array with: modelMethod).
+ actualMethods := context selectedMethods.
+
+ self assert: expectedMethods = actualMethods
+
+ "Created: / 19-11-2014 / 20:30:39 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+