evalhook 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 0.5.6 Removed ruby_parser dependency
2
+
1
3
  0.5.5 Fixed handling of method_missing
2
4
 
3
5
  0.5.4 Fixed release issues
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/testtask'
6
6
 
7
7
  spec = Gem::Specification.new do |s|
8
8
  s.name = 'evalhook'
9
- s.version = '0.5.6'
9
+ s.version = '0.5.7'
10
10
  s.author = 'Dario Seminara'
11
11
  s.email = 'robertodarioseminara@gmail.com'
12
12
  s.platform = Gem::Platform::RUBY
@@ -217,7 +217,7 @@ module EvalHook
217
217
  @last_args = tree[2]
218
218
  @last_method_name = tree[1]
219
219
 
220
- s(tree[0],tree[1],tree[2],process(tree[3]))
220
+ s(tree[0],tree[1],tree[2],*tree[3..-1].map(&method(:process)))
221
221
  end
222
222
 
223
223
  def superclass_call_tree
@@ -252,7 +252,7 @@ module EvalHook
252
252
 
253
253
  def process_defs(tree)
254
254
  block_tree = class_scope( "" ) {
255
- process(tree[4])
255
+ s(:block, *tree[4..-1].map(&method(:process)))
256
256
  }
257
257
  s(:defs, process(tree[1]), tree[2], tree[3], block_tree)
258
258
  end
@@ -0,0 +1,44 @@
1
+ require "rubygems"
2
+ require "evalhook"
3
+
4
+ describe EvalHook::HookHandler, "hook handler defn" do
5
+
6
+ class XXZ
7
+ def bar
8
+ end
9
+ end
10
+
11
+ it "should execute two lines on defn" do
12
+ hook_handler = EvalHook::HookHandler.new
13
+
14
+ hook_handler.evalhook("
15
+ def foo(x)
16
+ x.bar
17
+ x.bar
18
+ end", binding)
19
+
20
+ xxz = XXZ.new
21
+ xxz.should_receive(:bar).twice
22
+ foo(xxz)
23
+ end
24
+
25
+ it "should execute two lines on defs" do
26
+ hook_handler = EvalHook::HookHandler.new
27
+
28
+ hook_handler.evalhook("
29
+ def set_foo(obj)
30
+ def obj.foo(x)
31
+ x.bar
32
+ x.bar
33
+ end
34
+ end", binding)
35
+
36
+ obj = Object.new
37
+ set_foo(obj)
38
+
39
+ xxz = XXZ.new
40
+ xxz.should_receive(:bar).twice
41
+ obj.foo(xxz)
42
+ end
43
+
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evalhook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-17 00:00:00.000000000 Z
12
+ date: 2013-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: partialruby
16
- requirement: &82865840 !ruby/object:Gem::Requirement
16
+ requirement: &78285330 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *82865840
24
+ version_requirements: *78285330
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sexp_processor
27
- requirement: &82862480 !ruby/object:Gem::Requirement
27
+ requirement: &78284200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '4.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *82862480
35
+ version_requirements: *78284200
36
36
  description:
37
37
  email: robertodarioseminara@gmail.com
38
38
  executables: []
@@ -53,6 +53,7 @@ files:
53
53
  - spec/hook_handler/hook_handler_arguments_spec.rb
54
54
  - spec/hook_handler/hook_handler_package_spec.rb
55
55
  - spec/hook_handler/hook_handler_hook_spec.rb
56
+ - spec/hook_handler/hook_handler_defn_spec.rb
56
57
  - spec/hook_handler/hook_handler_ruby_spec.rb
57
58
  - spec/hook_handler/hook_handler_defaults_spec.rb
58
59
  - spec/hook_handler/hook_handler_multiple_redirect_spec.rb