eyeballer 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/eyeballer.rb +2 -2
- data/spec/eyeballer/eyeballer_spec.rb +11 -0
- metadata +1 -1
data/lib/eyeballer.rb
CHANGED
@@ -37,8 +37,8 @@ module Eyeballer
|
|
37
37
|
aliased_name = "#{method_name_without_punctuation}_without_eyeball#{punctuation}"
|
38
38
|
unless method_defined? aliased_name
|
39
39
|
alias_method aliased_name, method_name
|
40
|
-
define_method method_name do
|
41
|
-
result = self.send(aliased_name)
|
40
|
+
define_method method_name do |*args|
|
41
|
+
result = self.send(aliased_name, *args)
|
42
42
|
eyeball_executer(method_name)
|
43
43
|
result
|
44
44
|
end
|
@@ -21,6 +21,10 @@ class Foo
|
|
21
21
|
def destroy!
|
22
22
|
true
|
23
23
|
end
|
24
|
+
|
25
|
+
def echo(string)
|
26
|
+
string
|
27
|
+
end
|
24
28
|
end
|
25
29
|
|
26
30
|
class Job
|
@@ -45,6 +49,8 @@ class Observer
|
|
45
49
|
|
46
50
|
observe :foo, :destroy! => :email_someone
|
47
51
|
|
52
|
+
observe :foo, :echo => :do_something
|
53
|
+
|
48
54
|
def do_something
|
49
55
|
Job.number_one
|
50
56
|
end
|
@@ -97,4 +103,9 @@ describe Eyeballer do
|
|
97
103
|
Job.should_receive(:number_five).with(foo)
|
98
104
|
foo.destroy!.should be_true
|
99
105
|
end
|
106
|
+
|
107
|
+
it "should cope with methods which take arguments" do
|
108
|
+
Job.should_receive(:number_one)
|
109
|
+
Foo.new.echo("Repeat this text").should == "Repeat this text"
|
110
|
+
end
|
100
111
|
end
|