simple_callbacks 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,23 +33,23 @@ module AWS
33
33
  # version that runs a run_calbacks block and then delegates
34
34
  # to the origin method.
35
35
  update_without_callbacks = instance_method(:update)
36
- define_method :update do
37
- run_callbacks(:update){ update_without_callbacks.bind(self).() }
36
+ define_method :update do |*args|
37
+ run_callbacks(:update){ update_without_callbacks.bind(self).(*args) }
38
38
  end
39
39
 
40
40
  create_without_callbacks = instance_method(:create)
41
- define_method :create do
42
- run_callbacks(:create){ create_without_callbacks.bind(self).() }
41
+ define_method :create do |*args|
42
+ run_callbacks(:create){ create_without_callbacks.bind(self).(*args) }
43
43
  end
44
44
 
45
45
  save_without_callbacks = instance_method(:save)
46
- define_method :save do
47
- run_callbacks(:save){ save_without_callbacks.bind(self).() }
46
+ define_method :save do |*args|
47
+ run_callbacks(:save){ save_without_callbacks.bind(self).(*args) }
48
48
  end
49
49
 
50
50
  destroy_without_callbacks = instance_method(:destroy)
51
- define_method :destroy do
52
- run_callbacks(:destroy){ destroy_without_callbacks.bind(self).() }
51
+ define_method :destroy do |*args|
52
+ run_callbacks(:destroy){ destroy_without_callbacks.bind(self).(*args) }
53
53
  end
54
54
  end
55
55
 
@@ -1,3 +1,4 @@
1
+ require 'aws/record/validations'
1
2
  module AWS
2
3
  module Record
3
4
  module Validations
@@ -1,3 +1,3 @@
1
1
  module SimpleCallbacks
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -112,4 +112,25 @@ describe 'model validations' do
112
112
 
113
113
  end
114
114
 
115
+ describe "in a model" do
116
+ class Event < AWS::Record::Model
117
+ string_attr :name
118
+ before_validation :test_func
119
+ end
120
+
121
+ before(:each) do
122
+ Event.create_domain
123
+ Event.each{|u| u.destroy }
124
+ end
125
+
126
+
127
+ it "should work" do
128
+ #pp (Event.methods - Kernel.methods).sort
129
+ e = Event.new :name => "test"
130
+ e.should_receive(:test_func)
131
+ e.save
132
+ end
133
+
134
+ end
135
+
115
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_callbacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: