her 0.3.3 → 0.3.4
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/Rakefile +4 -4
- data/lib/her/api.rb +8 -8
- data/lib/her/collection.rb +2 -2
- data/lib/her/middleware/accept_json.rb +4 -4
- data/lib/her/middleware/first_level_parse_json.rb +4 -4
- data/lib/her/middleware/second_level_parse_json.rb +4 -4
- data/lib/her/model/hooks.rb +12 -12
- data/lib/her/model/http.rb +56 -56
- data/lib/her/model/introspection.rb +13 -13
- data/lib/her/model/orm.rb +85 -59
- data/lib/her/model/paths.rb +8 -8
- data/lib/her/model/relationships.rb +15 -13
- data/lib/her/version.rb +1 -1
- data/spec/api_spec.rb +16 -16
- data/spec/middleware/accept_json_spec.rb +2 -2
- data/spec/middleware/first_level_parse_json_spec.rb +4 -4
- data/spec/middleware/second_level_parse_json_spec.rb +4 -4
- data/spec/model/hooks_spec.rb +66 -66
- data/spec/model/http_spec.rb +56 -56
- data/spec/model/introspection_spec.rb +12 -12
- data/spec/model/orm_spec.rb +113 -94
- data/spec/model/paths_spec.rb +74 -74
- data/spec/model/relationships_spec.rb +52 -52
- metadata +5 -5
data/lib/her/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -4,20 +4,20 @@ require File.join(File.dirname(__FILE__), "spec_helper.rb")
|
|
4
4
|
describe Her::API do
|
5
5
|
context "initialization" do
|
6
6
|
describe ".setup" do
|
7
|
-
it "creates a default connection" do
|
7
|
+
it "creates a default connection" do
|
8
8
|
Her::API.setup :url => "https://api.example.com"
|
9
9
|
Her::API.default_api.base_uri.should == "https://api.example.com"
|
10
|
-
end
|
10
|
+
end
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "#setup" do
|
14
|
-
it "sets a base URI" do
|
14
|
+
it "sets a base URI" do
|
15
15
|
@api = Her::API.new
|
16
16
|
@api.setup :url => "https://api.example.com"
|
17
17
|
@api.base_uri.should == "https://api.example.com"
|
18
|
-
end
|
18
|
+
end
|
19
19
|
|
20
|
-
it "sets custom middleware with #use" do
|
20
|
+
it "sets custom middleware with #use" do
|
21
21
|
class Foo; end;
|
22
22
|
class Bar; end;
|
23
23
|
|
@@ -27,17 +27,17 @@ describe Her::API do
|
|
27
27
|
builder.use Bar
|
28
28
|
end
|
29
29
|
@api.connection.builder.handlers.should == [Foo, Bar]
|
30
|
-
end
|
30
|
+
end
|
31
31
|
|
32
|
-
it "takes custom options" do
|
32
|
+
it "takes custom options" do
|
33
33
|
@api = Her::API.new
|
34
34
|
@api.setup :foo => { :bar => "baz" }, :url => "https://api.example.com"
|
35
35
|
@api.options.should == { :foo => { :bar => "baz" }, :url => "https://api.example.com" }
|
36
|
-
end
|
36
|
+
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "#request" do
|
40
|
-
it "makes HTTP requests" do
|
40
|
+
it "makes HTTP requests" do
|
41
41
|
class SimpleParser < Faraday::Response::Middleware
|
42
42
|
def on_complete(env)
|
43
43
|
env[:body] = { :data => env[:body] }
|
@@ -55,9 +55,9 @@ describe Her::API do
|
|
55
55
|
|
56
56
|
parsed_data = @api.request(:_method => :get, :_path => "/foo")
|
57
57
|
parsed_data[:data] == "Foo, it is."
|
58
|
-
end
|
58
|
+
end
|
59
59
|
|
60
|
-
it "makes HTTP requests while specifying custom HTTP headers" do
|
60
|
+
it "makes HTTP requests while specifying custom HTTP headers" do
|
61
61
|
class SimpleParser < Faraday::Response::Middleware
|
62
62
|
def on_complete(env)
|
63
63
|
env[:body] = { :data => env[:body] }
|
@@ -75,9 +75,9 @@ describe Her::API do
|
|
75
75
|
|
76
76
|
parsed_data = @api.request(:_method => :get, :_path => "/foo", :_headers => { "X-Page" => 2 })
|
77
77
|
parsed_data[:data] == "Foo, it is page 2."
|
78
|
-
end
|
78
|
+
end
|
79
79
|
|
80
|
-
it "parses a request with the default parser" do
|
80
|
+
it "parses a request with the default parser" do
|
81
81
|
@api = Her::API.new
|
82
82
|
@api.setup :url => "https://api.example.com" do |builder|
|
83
83
|
builder.use Her::Middleware::FirstLevelParseJSON
|
@@ -90,9 +90,9 @@ describe Her::API do
|
|
90
90
|
parsed_data[:data].should == { :id => 1, :name => "George Michael Bluth" }
|
91
91
|
parsed_data[:errors].should == ["This is a single error"]
|
92
92
|
parsed_data[:metadata].should == { :page => 1, :per_page => 10 }
|
93
|
-
end
|
93
|
+
end
|
94
94
|
|
95
|
-
it "parses a request with a custom parser" do
|
95
|
+
it "parses a request with a custom parser" do
|
96
96
|
class CustomParser < Faraday::Response::Middleware
|
97
97
|
def on_complete(env)
|
98
98
|
json = MultiJson.load(env[:body], :symbolize_keys => true)
|
@@ -118,7 +118,7 @@ describe Her::API do
|
|
118
118
|
parsed_data[:data].should == { :id => 1, :name => "George Michael Bluth" }
|
119
119
|
parsed_data[:errors].should == []
|
120
120
|
parsed_data[:metadata].should == {}
|
121
|
-
end
|
121
|
+
end
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
require "spec_helper"
|
3
3
|
|
4
4
|
describe Her::Middleware::AcceptJSON do
|
5
|
-
it "adds an Accept header" do
|
5
|
+
it "adds an Accept header" do
|
6
6
|
described_class.new.add_header({}).tap do |headers|
|
7
7
|
headers["Accept"].should == "application/json"
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
10
10
|
end
|
@@ -5,15 +5,15 @@ describe Her::Middleware::FirstLevelParseJSON do
|
|
5
5
|
subject { described_class.new }
|
6
6
|
let(:body) { "{\"id\": 1, \"name\": \"Tobias Fünke\", \"errors\": 2, \"metadata\": 3}" }
|
7
7
|
|
8
|
-
it "parses body as json" do
|
8
|
+
it "parses body as json" do
|
9
9
|
subject.parse(body).tap do |json|
|
10
10
|
json[:data].should == { :id => 1, :name => "Tobias Fünke" }
|
11
11
|
json[:errors].should == 2
|
12
12
|
json[:metadata].should == 3
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
15
15
|
|
16
|
-
it "parses :body key as json in the env hash" do
|
16
|
+
it "parses :body key as json in the env hash" do
|
17
17
|
env = { :body => body }
|
18
18
|
subject.on_complete(env)
|
19
19
|
env[:body].tap do |json|
|
@@ -21,5 +21,5 @@ describe Her::Middleware::FirstLevelParseJSON do
|
|
21
21
|
json[:errors].should == 2
|
22
22
|
json[:metadata].should == 3
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
@@ -5,15 +5,15 @@ describe Her::Middleware::SecondLevelParseJSON do
|
|
5
5
|
subject { described_class.new }
|
6
6
|
let(:body) { "{\"data\": 1, \"errors\": 2, \"metadata\": 3}" }
|
7
7
|
|
8
|
-
it "parses body as json" do
|
8
|
+
it "parses body as json" do
|
9
9
|
subject.parse(body).tap do |json|
|
10
10
|
json[:data].should == 1
|
11
11
|
json[:errors].should == 2
|
12
12
|
json[:metadata].should == 3
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
15
15
|
|
16
|
-
it "parses :body key as json in the env hash" do
|
16
|
+
it "parses :body key as json in the env hash" do
|
17
17
|
env = { :body => body }
|
18
18
|
subject.on_complete(env)
|
19
19
|
env[:body].tap do |json|
|
@@ -21,5 +21,5 @@ describe Her::Middleware::SecondLevelParseJSON do
|
|
21
21
|
json[:errors].should == 2
|
22
22
|
json[:metadata].should == 3
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
data/spec/model/hooks_spec.rb
CHANGED
@@ -3,124 +3,124 @@ require File.join(File.dirname(__FILE__), "../spec_helper.rb")
|
|
3
3
|
|
4
4
|
describe Her::Model::Hooks do
|
5
5
|
context "adding hooks to a model" do
|
6
|
-
before do
|
6
|
+
before do
|
7
7
|
spawn_model "Foo::User"
|
8
|
-
end
|
8
|
+
end
|
9
9
|
|
10
10
|
describe "method hooks" do
|
11
|
-
it "handles “before save” method hooks" do
|
11
|
+
it "handles “before save” method hooks" do
|
12
12
|
Foo::User.before_save :set_internal_id
|
13
13
|
Foo::User.hooks[:before_save].length.should == 1
|
14
14
|
Foo::User.hooks[:before_save].first.class.should == Symbol
|
15
|
-
end
|
15
|
+
end
|
16
16
|
|
17
|
-
it "handles “before create” method hooks" do
|
17
|
+
it "handles “before create” method hooks" do
|
18
18
|
Foo::User.before_create :set_internal_id
|
19
19
|
Foo::User.hooks[:before_create].length.should == 1
|
20
20
|
Foo::User.hooks[:before_create].first.class.should == Symbol
|
21
|
-
end
|
21
|
+
end
|
22
22
|
|
23
|
-
it "handles “before update” method hooks" do
|
23
|
+
it "handles “before update” method hooks" do
|
24
24
|
Foo::User.before_update :set_internal_id
|
25
25
|
Foo::User.hooks[:before_update].length.should == 1
|
26
26
|
Foo::User.hooks[:before_update].first.class.should == Symbol
|
27
|
-
end
|
27
|
+
end
|
28
28
|
|
29
|
-
it "handles “before destroy” method hooks" do
|
29
|
+
it "handles “before destroy” method hooks" do
|
30
30
|
Foo::User.before_destroy :set_internal_id
|
31
31
|
Foo::User.hooks[:before_destroy].length.should == 1
|
32
32
|
Foo::User.hooks[:before_destroy].first.class.should == Symbol
|
33
|
-
end
|
33
|
+
end
|
34
34
|
|
35
|
-
it "handles “after save” method hooks" do
|
35
|
+
it "handles “after save” method hooks" do
|
36
36
|
Foo::User.after_save :set_internal_id
|
37
37
|
Foo::User.hooks[:after_save].length.should == 1
|
38
38
|
Foo::User.hooks[:after_save].first.class.should == Symbol
|
39
|
-
end
|
39
|
+
end
|
40
40
|
|
41
|
-
it "handles “after create” method hooks" do
|
41
|
+
it "handles “after create” method hooks" do
|
42
42
|
Foo::User.after_create :set_internal_id
|
43
43
|
Foo::User.hooks[:after_create].length.should == 1
|
44
44
|
Foo::User.hooks[:after_create].first.class.should == Symbol
|
45
|
-
end
|
45
|
+
end
|
46
46
|
|
47
|
-
it "handles “after update” method hooks" do
|
47
|
+
it "handles “after update” method hooks" do
|
48
48
|
Foo::User.after_update :set_internal_id
|
49
49
|
Foo::User.hooks[:after_update].length.should == 1
|
50
50
|
Foo::User.hooks[:after_update].first.class.should == Symbol
|
51
|
-
end
|
51
|
+
end
|
52
52
|
|
53
|
-
it "handles “after destroy” method hooks" do
|
53
|
+
it "handles “after destroy” method hooks" do
|
54
54
|
Foo::User.after_destroy :set_internal_id
|
55
55
|
Foo::User.hooks[:after_destroy].length.should == 1
|
56
56
|
Foo::User.hooks[:after_destroy].first.class.should == Symbol
|
57
|
-
end
|
57
|
+
end
|
58
58
|
end
|
59
59
|
|
60
60
|
describe "block hooks" do
|
61
|
-
it "handles “before save” block hooks" do
|
61
|
+
it "handles “before save” block hooks" do
|
62
62
|
Foo::User.before_save { |record| record.internal_id = 42 }
|
63
63
|
Foo::User.hooks[:before_save].length.should == 1
|
64
64
|
Foo::User.hooks[:before_save].first.class.should == Proc
|
65
|
-
end
|
65
|
+
end
|
66
66
|
|
67
|
-
it "handles “before create” block hooks" do
|
67
|
+
it "handles “before create” block hooks" do
|
68
68
|
Foo::User.before_create { |record| record.internal_id = 42 }
|
69
69
|
Foo::User.hooks[:before_create].length.should == 1
|
70
70
|
Foo::User.hooks[:before_create].first.class.should == Proc
|
71
|
-
end
|
71
|
+
end
|
72
72
|
|
73
|
-
it "handles “before update” block hooks" do
|
73
|
+
it "handles “before update” block hooks" do
|
74
74
|
Foo::User.before_update { |record| record.internal_id = 42 }
|
75
75
|
Foo::User.hooks[:before_update].length.should == 1
|
76
76
|
Foo::User.hooks[:before_update].first.class.should == Proc
|
77
|
-
end
|
77
|
+
end
|
78
78
|
|
79
|
-
it "handles “before destroy” block hooks" do
|
79
|
+
it "handles “before destroy” block hooks" do
|
80
80
|
Foo::User.before_destroy { |record| record.internal_id = 42 }
|
81
81
|
Foo::User.hooks[:before_destroy].length.should == 1
|
82
82
|
Foo::User.hooks[:before_destroy].first.class.should == Proc
|
83
|
-
end
|
83
|
+
end
|
84
84
|
|
85
|
-
it "handles “after save” block hooks" do
|
85
|
+
it "handles “after save” block hooks" do
|
86
86
|
Foo::User.after_save { |record| record.internal_id = 42 }
|
87
87
|
Foo::User.hooks[:after_save].length.should == 1
|
88
88
|
Foo::User.hooks[:after_save].first.class.should == Proc
|
89
|
-
end
|
89
|
+
end
|
90
90
|
|
91
|
-
it "handles “after create” block hooks" do
|
91
|
+
it "handles “after create” block hooks" do
|
92
92
|
Foo::User.after_create { |record| record.internal_id = 42 }
|
93
93
|
Foo::User.hooks[:after_create].length.should == 1
|
94
94
|
Foo::User.hooks[:after_create].first.class.should == Proc
|
95
|
-
end
|
95
|
+
end
|
96
96
|
|
97
|
-
it "handles “after update” block hooks" do
|
97
|
+
it "handles “after update” block hooks" do
|
98
98
|
Foo::User.after_update { |record| record.internal_id = 42 }
|
99
99
|
Foo::User.hooks[:after_update].length.should == 1
|
100
100
|
Foo::User.hooks[:after_update].first.class.should == Proc
|
101
|
-
end
|
101
|
+
end
|
102
102
|
|
103
|
-
it "handles “after destroy” block hooks" do
|
103
|
+
it "handles “after destroy” block hooks" do
|
104
104
|
Foo::User.after_destroy { |record| record.internal_id = 42 }
|
105
105
|
Foo::User.hooks[:after_destroy].length.should == 1
|
106
106
|
Foo::User.hooks[:after_destroy].first.class.should == Proc
|
107
|
-
end
|
107
|
+
end
|
108
108
|
end
|
109
109
|
|
110
110
|
context "inheriting hooks from a superclass" do
|
111
|
-
it "copies hooks to the subclass" do
|
111
|
+
it "copies hooks to the subclass" do
|
112
112
|
Foo::User.before_save :set_internal_id
|
113
113
|
Foo::User.after_create { |record| record.internal_id = 42 }
|
114
114
|
subclass = Class.new(Foo::User)
|
115
115
|
subclass.hooks.object_id.should_not == Foo::User.hooks.object_id
|
116
116
|
subclass.hooks[:before_save].should == [:set_internal_id]
|
117
117
|
subclass.hooks[:after_create].length.should == 1
|
118
|
-
end
|
118
|
+
end
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
context "perform hooks on a model" do
|
123
|
-
before do
|
123
|
+
before do
|
124
124
|
Her::API.setup :url => "https://api.example.com" do |builder|
|
125
125
|
builder.use Her::Middleware::FirstLevelParseJSON
|
126
126
|
builder.use Faraday::Request::UrlEncoded
|
@@ -146,10 +146,10 @@ describe Her::Model::Hooks do
|
|
146
146
|
def change_internal_after_update_id; @internal_after_update_id = 102; end
|
147
147
|
def change_internal_after_destroy_id; @internal_after_destroy_id = 103; end
|
148
148
|
end
|
149
|
-
end
|
149
|
+
end
|
150
150
|
|
151
151
|
describe "method hooks" do
|
152
|
-
before do
|
152
|
+
before do
|
153
153
|
Foo::User.before_save :change_internal_save_id
|
154
154
|
Foo::User.before_update :change_internal_update_id
|
155
155
|
Foo::User.before_create :change_internal_create_id
|
@@ -159,66 +159,66 @@ describe Her::Model::Hooks do
|
|
159
159
|
Foo::User.after_update :change_internal_after_update_id
|
160
160
|
Foo::User.after_create :change_internal_after_create_id
|
161
161
|
Foo::User.after_destroy :change_internal_after_destroy_id
|
162
|
-
end
|
162
|
+
end
|
163
163
|
|
164
|
-
it "perform “before save” “before create” method hook on Model#save without an ID" do
|
164
|
+
it "perform “before save” “before create” method hook on Model#save without an ID" do
|
165
165
|
@user = Foo::User.new(:fullname => "Tobias Fünke")
|
166
166
|
@user.save
|
167
167
|
@user.internal_save_id.should == 100
|
168
168
|
@user.internal_create_id.should == 101
|
169
169
|
@user.internal_update_id.should == nil
|
170
|
-
end
|
170
|
+
end
|
171
171
|
|
172
|
-
it "perform “before save” and “before update” method hook on Model#save with an ID" do
|
172
|
+
it "perform “before save” and “before update” method hook on Model#save with an ID" do
|
173
173
|
@user = Foo::User.find(1)
|
174
174
|
@user.save
|
175
175
|
@user.internal_save_id.should == 100
|
176
176
|
@user.internal_create_id.should == nil
|
177
177
|
@user.internal_update_id.should == 102
|
178
|
-
end
|
178
|
+
end
|
179
179
|
|
180
|
-
it "perform “before destroy” method hook on Model#destroy" do
|
180
|
+
it "perform “before destroy” method hook on Model#destroy" do
|
181
181
|
@user = Foo::User.find(1)
|
182
182
|
@user.destroy
|
183
183
|
@user.internal_save_id.should == nil
|
184
184
|
@user.internal_create_id.should == nil
|
185
185
|
@user.internal_update_id.should == nil
|
186
186
|
@user.internal_destroy_id.should == 103
|
187
|
-
end
|
187
|
+
end
|
188
188
|
|
189
|
-
it "perform “after save” “after create” method hook on Model#save without an ID" do
|
189
|
+
it "perform “after save” “after create” method hook on Model#save without an ID" do
|
190
190
|
@user = Foo::User.new(:fullname => "Tobias Fünke")
|
191
191
|
@user.save
|
192
192
|
@user.internal_after_save_id.should == 100
|
193
193
|
@user.internal_after_create_id.should == 101
|
194
194
|
@user.internal_after_update_id.should == nil
|
195
|
-
end
|
195
|
+
end
|
196
196
|
|
197
|
-
it "perform “after save” “after update” method hook on Model#save with an ID" do
|
197
|
+
it "perform “after save” “after update” method hook on Model#save with an ID" do
|
198
198
|
@user = Foo::User.find(1)
|
199
199
|
@user.save
|
200
200
|
@user.internal_after_save_id.should == 100
|
201
201
|
@user.internal_after_create_id.should == nil
|
202
202
|
@user.internal_after_update_id.should == 102
|
203
|
-
end
|
203
|
+
end
|
204
204
|
|
205
|
-
it "perform “after save” “after update” method hook on Model.save_existing" do
|
205
|
+
it "perform “after save” “after update” method hook on Model.save_existing" do
|
206
206
|
@user = Foo::User.save_existing(1, { :fullname => "Tobias Fünke" })
|
207
207
|
@user.internal_after_save_id.should == 100
|
208
208
|
@user.internal_after_create_id.should == nil
|
209
209
|
@user.internal_after_update_id.should == 102
|
210
|
-
end
|
210
|
+
end
|
211
211
|
|
212
|
-
it "perform “after save” “after create” method hook on Model.create" do
|
212
|
+
it "perform “after save” “after create” method hook on Model.create" do
|
213
213
|
@user = Foo::User.create({ :fullname => "Tobias Fünke" })
|
214
214
|
@user.internal_after_save_id.should == 100
|
215
215
|
@user.internal_after_create_id.should == 101
|
216
216
|
@user.internal_after_update_id.should == nil
|
217
|
-
end
|
217
|
+
end
|
218
218
|
end
|
219
219
|
|
220
220
|
describe "block hooks" do
|
221
|
-
before do
|
221
|
+
before do
|
222
222
|
Foo::User.before_save { |record| record.internal_save_id = 200 }
|
223
223
|
Foo::User.before_create { |record| record.internal_create_id = 201 }
|
224
224
|
Foo::User.before_update { |record| record.internal_update_id = 202 }
|
@@ -228,48 +228,48 @@ describe Her::Model::Hooks do
|
|
228
228
|
Foo::User.after_create { |record| record.internal_after_create_id = 201 }
|
229
229
|
Foo::User.after_update { |record| record.internal_after_update_id = 202 }
|
230
230
|
Foo::User.after_destroy { |record| record.internal_after_destroy_id = 203 }
|
231
|
-
end
|
231
|
+
end
|
232
232
|
|
233
|
-
it "perform “before save” and “before create” block hook on Model#save without an ID" do
|
233
|
+
it "perform “before save” and “before create” block hook on Model#save without an ID" do
|
234
234
|
@user = Foo::User.new(:fullname => "Tobias Fünke")
|
235
235
|
@user.save
|
236
236
|
@user.internal_save_id.should == 200
|
237
237
|
@user.internal_create_id.should == 201
|
238
238
|
@user.internal_update_id.should == nil
|
239
|
-
end
|
239
|
+
end
|
240
240
|
|
241
|
-
it "perform “before save” and “before update” block hook on Model#save with an ID" do
|
241
|
+
it "perform “before save” and “before update” block hook on Model#save with an ID" do
|
242
242
|
@user = Foo::User.find(1)
|
243
243
|
@user.save
|
244
244
|
@user.internal_save_id.should == 200
|
245
245
|
@user.internal_create_id.should == nil
|
246
246
|
@user.internal_update_id.should == 202
|
247
|
-
end
|
247
|
+
end
|
248
248
|
|
249
|
-
it "perform “before destroy” block hook on Model#destroy" do
|
249
|
+
it "perform “before destroy” block hook on Model#destroy" do
|
250
250
|
@user = Foo::User.find(1)
|
251
251
|
@user.destroy
|
252
252
|
@user.internal_save_id.should == nil
|
253
253
|
@user.internal_create_id.should == nil
|
254
254
|
@user.internal_update_id.should == nil
|
255
255
|
@user.internal_destroy_id.should == 203
|
256
|
-
end
|
256
|
+
end
|
257
257
|
|
258
|
-
it "perform “after save” “after create” block hook on Model#save without an ID" do
|
258
|
+
it "perform “after save” “after create” block hook on Model#save without an ID" do
|
259
259
|
@user = Foo::User.new(:fullname => "Tobias Fünke")
|
260
260
|
@user.save
|
261
261
|
@user.internal_after_save_id.should == 200
|
262
262
|
@user.internal_after_create_id.should == 201
|
263
263
|
@user.internal_after_update_id.should == nil
|
264
|
-
end
|
264
|
+
end
|
265
265
|
|
266
|
-
it "perform “after save” “after update” block hook on Model#save with an ID" do
|
266
|
+
it "perform “after save” “after update” block hook on Model#save with an ID" do
|
267
267
|
@user = Foo::User.find(1)
|
268
268
|
@user.save
|
269
269
|
@user.internal_after_save_id.should == 200
|
270
270
|
@user.internal_after_create_id.should == nil
|
271
271
|
@user.internal_after_update_id.should == 202
|
272
|
-
end
|
272
|
+
end
|
273
273
|
end
|
274
274
|
end
|
275
275
|
end
|