action_tree 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +0,0 @@
1
-
2
- require 'action_tree'
3
-
4
-
5
-
6
- describe ActionTree::EvalScope do
7
- it 'has access to local variables' do
8
- @say = 'tra la la a ring a ding ding'
9
- ActionTree::EvalScope.new(self).instance_eval do
10
- @say
11
- end.should == 'tra la la a ring a ding ding'
12
- end
13
-
14
- it 'extends modules' do
15
- module Hooga
16
- def words_of_wisdom
17
- 'touch my tra la la my ding ding dong'
18
- end
19
- end
20
- ActionTree::EvalScope.new(Hooga).words_of_wisdom.should ==
21
- 'touch my tra la la my ding ding dong'
22
- end
23
-
24
- it 'overwrites sooner with later extensions' do
25
- prepare = Proc.new { @greeting = 'Hello' }
26
- greet = Proc.new { "#{@greeting} #{get_name}" }
27
- module Booga
28
- def get_name
29
- 'Melchior'
30
- end
31
- end
32
- module Shooga
33
- def get_name
34
- 'Baltazar'
35
- end
36
- end
37
- scope = ActionTree::EvalScope.new(Booga, Shooga, self)
38
- scope.instance_eval(&prepare)
39
- scope.instance_eval(&greet).should == 'Hello Baltazar'
40
- end
41
- end