rspec-rails 2.14.0.rc1 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +12 -0
  3. data/README.md +2 -2
  4. data/features/Autotest.md +24 -0
  5. data/features/Generators.md +24 -0
  6. data/features/GettingStarted.md +84 -0
  7. data/features/README.md +56 -0
  8. data/features/RailsVersions.md +4 -0
  9. data/features/Transactions.md +84 -0
  10. data/features/Upgrade.md +121 -0
  11. data/features/controller_specs/Cookies.md +57 -0
  12. data/features/controller_specs/README.md +45 -0
  13. data/features/controller_specs/anonymous_controller.feature +378 -0
  14. data/features/controller_specs/bypass_rescue.feature +75 -0
  15. data/features/controller_specs/controller_spec.feature +58 -0
  16. data/features/controller_specs/engine_routes.feature +51 -0
  17. data/features/controller_specs/isolation_from_views.feature +87 -0
  18. data/features/controller_specs/render_views.feature +114 -0
  19. data/features/feature_specs/feature_spec.feature +34 -0
  20. data/features/helper_specs/helper_spec.feature +122 -0
  21. data/features/mailer_specs/url_helpers.feature +38 -0
  22. data/features/matchers/README.md +18 -0
  23. data/features/matchers/new_record_matcher.feature +41 -0
  24. data/features/matchers/redirect_to_matcher.feature +40 -0
  25. data/features/matchers/relation_match_array.feature +22 -0
  26. data/features/matchers/render_template_matcher.feature +49 -0
  27. data/features/mocks/mock_model.feature +147 -0
  28. data/features/mocks/stub_model.feature +58 -0
  29. data/features/model_specs/README.md +21 -0
  30. data/features/model_specs/errors_on.feature +51 -0
  31. data/features/model_specs/records.feature +27 -0
  32. data/features/model_specs/transactional_examples.feature +109 -0
  33. data/features/request_specs/request_spec.feature +49 -0
  34. data/features/routing_specs/README.md +16 -0
  35. data/features/routing_specs/be_routable_matcher.feature +80 -0
  36. data/features/routing_specs/engine_routes.feature +38 -0
  37. data/features/routing_specs/named_routes.feature +18 -0
  38. data/features/routing_specs/route_to_matcher.feature +90 -0
  39. data/features/step_definitions/additional_cli_steps.rb +4 -0
  40. data/features/step_definitions/model_steps.rb +3 -0
  41. data/features/support/env.rb +53 -0
  42. data/features/support/rails_versions.rb +4 -0
  43. data/features/view_specs/inferred_controller_path.feature +45 -0
  44. data/features/view_specs/stub_template.feature +51 -0
  45. data/features/view_specs/view_spec.feature +206 -0
  46. data/lib/rspec/rails/example/controller_example_group.rb +2 -4
  47. data/lib/rspec/rails/extensions/active_record/base.rb +8 -2
  48. data/lib/rspec/rails/mocks.rb +15 -10
  49. data/lib/rspec/rails/tasks/rspec.rake +7 -7
  50. data/lib/rspec/rails/version.rb +1 -1
  51. data/spec/autotest/rails_rspec2_spec.rb +36 -0
  52. data/spec/generators/rspec/controller/controller_generator_spec.rb +97 -0
  53. data/spec/generators/rspec/helper/helper_generator_spec.rb +30 -0
  54. data/spec/generators/rspec/install/install_generator_spec.rb +30 -0
  55. data/spec/generators/rspec/integration/integration_generator_spec.rb +44 -0
  56. data/spec/generators/rspec/mailer/mailer_generator_spec.rb +48 -0
  57. data/spec/generators/rspec/model/model_generator_spec.rb +52 -0
  58. data/spec/generators/rspec/observer/observer_generator_spec.rb +21 -0
  59. data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +138 -0
  60. data/spec/generators/rspec/view/view_generator_spec.rb +41 -0
  61. data/spec/rspec/rails/assertion_adapter_spec.rb +28 -0
  62. data/spec/rspec/rails/assertion_delegator_spec.rb +43 -0
  63. data/spec/rspec/rails/configuration_spec.rb +26 -0
  64. data/spec/rspec/rails/deprecations_spec.rb +18 -0
  65. data/spec/rspec/rails/example/controller_example_group_spec.rb +100 -0
  66. data/spec/rspec/rails/example/feature_example_group_spec.rb +56 -0
  67. data/spec/rspec/rails/example/helper_example_group_spec.rb +64 -0
  68. data/spec/rspec/rails/example/mailer_example_group_spec.rb +21 -0
  69. data/spec/rspec/rails/example/model_example_group_spec.rb +15 -0
  70. data/spec/rspec/rails/example/request_example_group_spec.rb +17 -0
  71. data/spec/rspec/rails/example/routing_example_group_spec.rb +32 -0
  72. data/spec/rspec/rails/example/view_example_group_spec.rb +220 -0
  73. data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +23 -0
  74. data/spec/rspec/rails/extensions/active_record/base_spec.rb +42 -0
  75. data/spec/rspec/rails/fixture_support_spec.rb +17 -0
  76. data/spec/rspec/rails/matchers/be_a_new_spec.rb +142 -0
  77. data/spec/rspec/rails/matchers/be_new_record_spec.rb +33 -0
  78. data/spec/rspec/rails/matchers/be_routable_spec.rb +41 -0
  79. data/spec/rspec/rails/matchers/be_valid_spec.rb +44 -0
  80. data/spec/rspec/rails/matchers/errors_on_spec.rb +38 -0
  81. data/spec/rspec/rails/matchers/has_spec.rb +29 -0
  82. data/spec/rspec/rails/matchers/have_rendered_spec.rb +93 -0
  83. data/spec/rspec/rails/matchers/redirect_to_spec.rb +80 -0
  84. data/spec/rspec/rails/matchers/relation_match_array_spec.rb +31 -0
  85. data/spec/rspec/rails/matchers/route_to_spec.rb +151 -0
  86. data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +22 -0
  87. data/spec/rspec/rails/mocks/mock_model_spec.rb +379 -0
  88. data/spec/rspec/rails/mocks/stub_model_spec.rb +154 -0
  89. data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +32 -0
  90. data/spec/rspec/rails/view_rendering_spec.rb +111 -0
  91. data/spec/spec_helper.rb +31 -0
  92. data/spec/support/ar_classes.rb +42 -0
  93. data/spec/support/helpers.rb +20 -0
  94. data/spec/support/matchers.rb +9 -0
  95. data/spec/support/null_object.rb +6 -0
  96. metadata +192 -18
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe RSpec::Rails::MiniTestLifecycleAdapter do
4
+ it "invokes minitest lifecycle hooks at the appropriate times" do
5
+ invocations = []
6
+ example_group = RSpec::Core::ExampleGroup.describe("MiniTestHooks") do
7
+ include RSpec::Rails::MiniTestLifecycleAdapter
8
+
9
+ define_method(:before_setup) { invocations << :before_setup }
10
+ define_method(:after_setup) { invocations << :after_setup }
11
+ define_method(:before_teardown) { invocations << :before_teardown }
12
+ define_method(:after_teardown) { invocations << :after_teardown }
13
+ end
14
+
15
+ example = example_group.example("foo") { invocations << :example }
16
+ example_group.run(NullObject.new)
17
+
18
+ expect(invocations).to eq([
19
+ :before_setup, :after_setup, :example, :before_teardown, :after_teardown
20
+ ])
21
+ end
22
+ end
@@ -0,0 +1,379 @@
1
+ require 'spec_helper'
2
+
3
+ describe "mock_model(RealModel)" do
4
+
5
+ context "given a String" do
6
+ context "that does not represent an existing constant" do
7
+ it "class says it's name" do
8
+ model = mock_model("Foo")
9
+ model.class.name.should eq("Foo")
10
+ end
11
+ end
12
+
13
+ context "that represents an existing constant" do
14
+ context "that extends ActiveModel::Naming" do
15
+ it "treats the constant as the class" do
16
+ model = mock_model("MockableModel")
17
+ model.class.name.should eq("MockableModel")
18
+ end
19
+ end
20
+
21
+ context "that does not extend ActiveModel::Naming" do
22
+ it "raises with a helpful message" do
23
+ expect do
24
+ mock_model("String")
25
+ end.to raise_error(ArgumentError)
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ context "given a class that does not extend ActiveModel::Naming" do
32
+ it "raises with a helpful message" do
33
+ expect do
34
+ mock_model(String)
35
+ end.to raise_error(ArgumentError)
36
+ end
37
+ end
38
+
39
+ describe "with #id stubbed" do
40
+ before(:each) do
41
+ @model = mock_model(MockableModel, :id => 1)
42
+ end
43
+
44
+ it "is named using the stubbed id value" do
45
+ @model.instance_variable_get(:@name).should == "MockableModel_1"
46
+ end
47
+ end
48
+
49
+ describe "destroy" do
50
+ it "sets persisted to false" do
51
+ model = mock_model(MockableModel)
52
+ model.destroy
53
+ model.should_not be_persisted
54
+ end
55
+ end
56
+
57
+ describe "errors" do
58
+ context "default" do
59
+ it "is empty" do
60
+ model = mock_model(MockableModel)
61
+ model.errors.should be_empty
62
+ end
63
+ end
64
+
65
+ context "with :save => false" do
66
+ it "is not empty" do
67
+ model = mock_model(MockableModel, :save => false)
68
+ model.errors.should_not be_empty
69
+ end
70
+ end
71
+
72
+ context "with :update_attributes => false" do
73
+ it "is not empty" do
74
+ model = mock_model(MockableModel, :save => false)
75
+ model.errors.should_not be_empty
76
+ end
77
+ end
78
+ end
79
+
80
+ describe "with params" do
81
+ it "does not mutate its parameters" do
82
+ params = {:a => 'b'}
83
+ mock_model(MockableModel, params)
84
+ params.should == {:a => 'b'}
85
+ end
86
+ end
87
+
88
+ describe "as association" do
89
+ before(:each) do
90
+ @real = AssociatedModel.create!
91
+ @mock_model = mock_model(MockableModel)
92
+ @real.mockable_model = @mock_model
93
+ end
94
+
95
+ it "passes: associated_model == mock" do
96
+ @mock_model.should == @real.mockable_model
97
+ end
98
+
99
+ it "passes: mock == associated_model" do
100
+ @real.mockable_model.should == @mock_model
101
+ end
102
+ end
103
+
104
+ describe "as association that doesn't exist yet" do
105
+ before(:each) do
106
+ @real = AssociatedModel.create!
107
+ @mock_model = mock_model("Other")
108
+ @real.nonexistent_model = @mock_model
109
+ end
110
+
111
+ it "passes: associated_model == mock" do
112
+ @mock_model.should == @real.nonexistent_model
113
+ end
114
+
115
+ it "passes: mock == associated_model" do
116
+ @real.nonexistent_model.should == @mock_model
117
+ end
118
+ end
119
+
120
+ describe "#is_a?" do
121
+ before(:each) do
122
+ @model = mock_model(SubMockableModel)
123
+ end
124
+
125
+ it "says it is_a?(RealModel)" do
126
+ @model.is_a?(SubMockableModel).should be(true)
127
+ end
128
+
129
+ it "says it is_a?(OtherModel) if RealModel is an ancestors" do
130
+ @model.is_a?(MockableModel).should be(true)
131
+ end
132
+
133
+ it "can be stubbed" do
134
+ mock_model(MockableModel, :is_a? => true).is_a?(:Foo).should be_true
135
+ end
136
+ end
137
+
138
+ describe "#kind_of?" do
139
+ before(:each) do
140
+ @model = mock_model(SubMockableModel)
141
+ end
142
+
143
+ it "says it is kind_of? if RealModel is" do
144
+ @model.kind_of?(SubMockableModel).should be(true)
145
+ end
146
+
147
+ it "says it is kind_of? if RealModel's ancestor is" do
148
+ @model.kind_of?(MockableModel).should be(true)
149
+ end
150
+
151
+ it "can be stubbed" do
152
+ mock_model(MockableModel, :kind_of? => true).kind_of?(:Foo).should be_true
153
+ end
154
+ end
155
+
156
+ describe "#instance_of?" do
157
+ before(:each) do
158
+ @model = mock_model(SubMockableModel)
159
+ end
160
+
161
+ it "says it is instance_of? if RealModel is" do
162
+ @model.instance_of?(SubMockableModel).should be(true)
163
+ end
164
+
165
+ it "does not say it instance_of? if RealModel isn't, even if it's ancestor is" do
166
+ @model.instance_of?(MockableModel).should be(false)
167
+ end
168
+
169
+ it "can be stubbed" do
170
+ mock_model(MockableModel, :instance_of? => true).instance_of?(:Foo).should be_true
171
+ end
172
+ end
173
+
174
+ describe "#respond_to?" do
175
+ context "with an ActiveRecord model" do
176
+ before(:each) do
177
+ MockableModel.stub(:column_names).and_return(["column_a", "column_b"])
178
+ @model = mock_model(MockableModel)
179
+ end
180
+
181
+ it "accepts two arguments" do
182
+ expect do
183
+ @model.respond_to?("title_before_type_cast", false)
184
+ end.to_not raise_exception
185
+ end
186
+
187
+ context "without as_null_object" do
188
+ it "says it will respond_to?(key) if RealModel has the attribute 'key'" do
189
+ @model.respond_to?("column_a").should be(true)
190
+ end
191
+ it "stubs column accessor (with string)" do
192
+ @model.respond_to?("column_a")
193
+ @model.column_a.should be_nil
194
+ end
195
+ it "stubs column accessor (with symbol)" do
196
+ @model.respond_to?(:column_a)
197
+ @model.column_a.should be_nil
198
+ end
199
+ it "does not stub column accessor if already stubbed in declaration (with string)" do
200
+ model = mock_model(MockableModel, "column_a" => "a")
201
+ model.respond_to?("column_a")
202
+ model.column_a.should eq("a")
203
+ end
204
+ it "does not stub column accessor if already stubbed in declaration (with symbol)" do
205
+ model = mock_model(MockableModel, :column_a => "a")
206
+ model.respond_to?("column_a")
207
+ model.column_a.should eq("a")
208
+ end
209
+ it "does not stub column accessor if already stubbed after declaration (with string)" do
210
+ @model.stub("column_a" => "a")
211
+ @model.respond_to?("column_a")
212
+ @model.column_a.should eq("a")
213
+ end
214
+ it "does not stub column accessor if already stubbed after declaration (with symbol)" do
215
+ @model.stub(:column_a => "a")
216
+ @model.respond_to?("column_a")
217
+ @model.column_a.should eq("a")
218
+ end
219
+ it "says it will not respond_to?(key) if RealModel does not have the attribute 'key'" do
220
+ @model.respond_to?("column_c").should be(false)
221
+ end
222
+ it "says it will not respond_to?(xxx_before_type_cast)" do
223
+ @model.respond_to?("title_before_type_cast").should be(false)
224
+ end
225
+ end
226
+
227
+ context "with as_null_object" do
228
+ it "says it will respond_to?(key) if RealModel has the attribute 'key'" do
229
+ @model.as_null_object.respond_to?("column_a").should be(true)
230
+ end
231
+ it "says it will respond_to?(key) even if RealModel does not have the attribute 'key'" do
232
+ @model.as_null_object.respond_to?("column_c").should be(true)
233
+ end
234
+ it "says it will not respond_to?(xxx_before_type_cast)" do
235
+ @model.as_null_object.respond_to?("title_before_type_cast").should be(false)
236
+ end
237
+ it "returns self for any unprepared message" do
238
+ @model.as_null_object.tap do |x|
239
+ x.non_existant_message.should be(@model)
240
+ end
241
+ end
242
+ end
243
+ end
244
+
245
+ context "with a non-ActiveRecord model" do
246
+ it "responds as normal" do
247
+ model = NonActiveRecordModel.new
248
+ model.should respond_to(:to_param)
249
+ end
250
+
251
+ context "with as_null_object" do
252
+ it "says it will not respond_to?(xxx_before_type_cast)" do
253
+ model = NonActiveRecordModel.new.as_null_object
254
+ model.respond_to?("title_before_type_cast").should be(false)
255
+ end
256
+ end
257
+ end
258
+
259
+ it "can be stubbed" do
260
+ mock_model(MockableModel, :respond_to? => true).respond_to?(:foo).should be_true
261
+ end
262
+ end
263
+
264
+ describe "#class" do
265
+ it "returns the mocked model" do
266
+ mock_model(MockableModel).class.should eq(MockableModel)
267
+ end
268
+
269
+ it "can be stubbed" do
270
+ mock_model(MockableModel, :class => String).class.should be(String)
271
+ end
272
+ end
273
+
274
+ describe "#to_s" do
275
+ it "returns (model.name)_(model#to_param)" do
276
+ mock_model(MockableModel).to_s.should == "MockableModel_#{to_param}"
277
+ end
278
+
279
+ it "can be stubbed" do
280
+ mock_model(MockableModel, :to_s => "this string").to_s.should == "this string"
281
+ end
282
+ end
283
+
284
+ describe "#destroyed?" do
285
+ context "default" do
286
+ it "returns false" do
287
+ @model = mock_model(SubMockableModel)
288
+ @model.destroyed?.should be(false)
289
+ end
290
+ end
291
+ end
292
+
293
+ describe "#marked_for_destruction?" do
294
+ context "default" do
295
+ it "returns false" do
296
+ @model = mock_model(SubMockableModel)
297
+ @model.marked_for_destruction?.should be(false)
298
+ end
299
+ end
300
+ end
301
+
302
+ describe "#persisted?" do
303
+ context "with default identifier" do
304
+ it "returns true" do
305
+ mock_model(MockableModel).should be_persisted
306
+ end
307
+ end
308
+
309
+ context "with explicit identifier via :id" do
310
+ it "returns true" do
311
+ mock_model(MockableModel, :id => 37).should be_persisted
312
+ end
313
+ end
314
+
315
+ context "with id => nil" do
316
+ it "returns false" do
317
+ mock_model(MockableModel, :id => nil).should_not be_persisted
318
+ end
319
+ end
320
+ end
321
+
322
+ describe "#valid?" do
323
+ context "default" do
324
+ it "returns true" do
325
+ mock_model(MockableModel).should be_valid
326
+ end
327
+ end
328
+
329
+ context "stubbed with false" do
330
+ it "returns false" do
331
+ mock_model(MockableModel, :valid? => false).should_not be_valid
332
+ end
333
+ end
334
+ end
335
+
336
+ describe "#as_new_record" do
337
+ it "says it is a new record" do
338
+ m = mock_model(MockableModel)
339
+ m.as_new_record.should be_new_record
340
+ end
341
+
342
+ it "says it is not persisted" do
343
+ m = mock_model(MockableModel)
344
+ m.as_new_record.should_not be_persisted
345
+ end
346
+
347
+ it "has a nil id" do
348
+ mock_model(MockableModel).as_new_record.id.should be(nil)
349
+ end
350
+
351
+ it "returns nil for #to_param" do
352
+ mock_model(MockableModel).as_new_record.to_param.should be(nil)
353
+ end
354
+ end
355
+
356
+ describe "#blank?" do
357
+ it "is false" do
358
+ mock_model(MockableModel).should_not be_blank
359
+ end
360
+ end
361
+
362
+ describe "ActiveModel Lint tests" do
363
+ require 'test/unit/assertions'
364
+ require 'active_model/lint'
365
+ include RSpec::Rails::TestUnitAssertionAdapter
366
+ include ActiveModel::Lint::Tests
367
+
368
+ # to_s is to support ruby-1.9
369
+ ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
370
+ example m.gsub('_',' ') do
371
+ send m
372
+ end
373
+ end
374
+
375
+ def model
376
+ mock_model(MockableModel, :id => nil)
377
+ end
378
+ end
379
+ end
@@ -0,0 +1,154 @@
1
+ require 'spec_helper'
2
+
3
+ describe "stub_model" do
4
+
5
+ shared_examples_for "stub model" do
6
+ describe "with a block" do
7
+ it "yields the model" do
8
+ model = stub_model(model_class) do |block_arg|
9
+ @block_arg = block_arg
10
+ end
11
+ model.should be(@block_arg)
12
+ end
13
+ end
14
+
15
+ describe "#persisted?" do
16
+ context "default" do
17
+ it "returns true" do
18
+ model = stub_model(model_class)
19
+ model.should be_persisted
20
+ end
21
+ end
22
+
23
+ context "with as_new_record" do
24
+ it "returns false" do
25
+ model = stub_model(model_class).as_new_record
26
+ model.should_not be_persisted
27
+ end
28
+ end
29
+ end
30
+
31
+ it "increments the value returned by to_param" do
32
+ first = stub_model(model_class)
33
+ second = stub_model(model_class)
34
+ second.to_param.to_i.should == (first.to_param.to_i + 1)
35
+ end
36
+
37
+ describe "#blank?" do
38
+ it "is false" do
39
+ stub_model(model_class).should_not be_blank
40
+ end
41
+ end
42
+ end
43
+
44
+ context "with ActiveModel (not ActiveRecord)" do
45
+ it_behaves_like "stub model" do
46
+ def model_class
47
+ NonActiveRecordModel
48
+ end
49
+ end
50
+ end
51
+
52
+ context "with an ActiveRecord model" do
53
+ let(:model_class) { MockableModel }
54
+
55
+ it_behaves_like "stub model"
56
+
57
+ describe "#new_record?" do
58
+ context "default" do
59
+ it "returns false" do
60
+ model = stub_model(model_class)
61
+ model.new_record?.should be_false
62
+ end
63
+ end
64
+
65
+ context "with as_new_record" do
66
+ it "returns true" do
67
+ model = stub_model(model_class).as_new_record
68
+ model.new_record?.should be_true
69
+ end
70
+ end
71
+ end
72
+
73
+ describe "defaults" do
74
+ it "has an id" do
75
+ stub_model(MockableModel).id.should be > 0
76
+ end
77
+
78
+ it "says it is not a new record" do
79
+ stub_model(MockableModel).should_not be_new_record
80
+ end
81
+ end
82
+
83
+ describe "#as_new_record" do
84
+ it "has a nil id" do
85
+ stub_model(MockableModel).as_new_record.id.should be(nil)
86
+ end
87
+ end
88
+
89
+ it "raises when hitting the db" do
90
+ lambda do
91
+ stub_model(MockableModel).connection
92
+ end.should raise_error(RSpec::Rails::IllegalDataAccessException, /stubbed models are not allowed to access the database/)
93
+ end
94
+
95
+ it "increments the id" do
96
+ first = stub_model(model_class)
97
+ second = stub_model(model_class)
98
+ second.id.should == (first.id + 1)
99
+ end
100
+
101
+ it "accepts a stub id" do
102
+ stub_model(MockableModel, :id => 37).id.should == 37
103
+ end
104
+
105
+ it "says it is a new record when id is set to nil" do
106
+ stub_model(MockableModel, :id => nil).should be_new_record
107
+ end
108
+
109
+ it "accepts a stub for save" do
110
+ stub_model(MockableModel, :save => false).save.should be(false)
111
+ end
112
+
113
+ describe "alternate primary key" do
114
+ it "has the correct primary_key name" do
115
+ stub_model(AlternatePrimaryKeyModel).class.primary_key.to_s.should eq('my_id')
116
+ end
117
+
118
+ it "has a primary_key" do
119
+ stub_model(AlternatePrimaryKeyModel).my_id.should be > 0
120
+ end
121
+
122
+ it "says it is not a new record" do
123
+ stub_model(AlternatePrimaryKeyModel) do |m|
124
+ m.should_not be_new_record
125
+ end
126
+ end
127
+
128
+ it "says it is a new record if primary_key is nil" do
129
+ stub_model(AlternatePrimaryKeyModel, :my_id => nil).should be_new_record
130
+ end
131
+
132
+ it "accepts a stub for the primary_key" do
133
+ stub_model(AlternatePrimaryKeyModel, :my_id => 5).my_id.should == 5
134
+ end
135
+ end
136
+
137
+ describe "as association" do
138
+ before(:each) do
139
+ @real = AssociatedModel.create!
140
+ @stub_model = stub_model(MockableModel)
141
+ @real.mockable_model = @stub_model
142
+ end
143
+
144
+ it "passes associated_model == mock" do
145
+ @stub_model.should == @real.mockable_model
146
+ end
147
+
148
+ it "passes mock == associated_model" do
149
+ @real.mockable_model.should == @stub_model
150
+ end
151
+ end
152
+
153
+ end
154
+ end