shoulda 2.0.6 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +35 -7
- data/Rakefile +5 -3
- data/lib/shoulda.rb +7 -15
- data/lib/shoulda/action_mailer.rb +1 -1
- data/lib/shoulda/action_mailer/assertions.rb +32 -33
- data/lib/shoulda/active_record.rb +6 -2
- data/lib/shoulda/active_record/assertions.rb +62 -81
- data/lib/shoulda/active_record/helpers.rb +40 -0
- data/lib/shoulda/active_record/macros.rb +518 -639
- data/lib/shoulda/active_record/matchers.rb +42 -0
- data/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +83 -0
- data/lib/shoulda/active_record/matchers/allow_value_matcher.rb +102 -0
- data/lib/shoulda/active_record/matchers/association_matcher.rb +226 -0
- data/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +87 -0
- data/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +141 -0
- data/lib/shoulda/active_record/matchers/have_db_column_matcher.rb +169 -0
- data/lib/shoulda/active_record/matchers/have_index_matcher.rb +105 -0
- data/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb +125 -0
- data/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +59 -0
- data/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +41 -0
- data/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +39 -0
- data/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +60 -0
- data/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +148 -0
- data/lib/shoulda/active_record/matchers/validation_matcher.rb +56 -0
- data/lib/shoulda/assertions.rb +50 -40
- data/lib/shoulda/autoload_macros.rb +46 -0
- data/lib/shoulda/context.rb +124 -126
- data/lib/shoulda/controller.rb +8 -8
- data/lib/shoulda/controller/formats/html.rb +158 -160
- data/lib/shoulda/controller/formats/xml.rb +132 -134
- data/lib/shoulda/controller/helpers.rb +51 -53
- data/lib/shoulda/controller/macros.rb +278 -258
- data/lib/shoulda/controller/resource_options.rb +211 -214
- data/lib/shoulda/helpers.rb +5 -7
- data/lib/shoulda/macros.rb +63 -64
- data/lib/shoulda/private_helpers.rb +16 -18
- data/lib/shoulda/rails.rb +1 -8
- data/lib/shoulda/rspec.rb +5 -0
- data/lib/shoulda/tasks/list_tests.rake +6 -1
- data/lib/shoulda/test_unit.rb +19 -0
- data/rails/init.rb +1 -1
- data/test/README +2 -2
- data/test/fail_macros.rb +16 -16
- data/test/functional/posts_controller_test.rb +5 -2
- data/test/matchers/allow_mass_assignment_of_matcher_test.rb +68 -0
- data/test/matchers/allow_value_matcher_test.rb +41 -0
- data/test/matchers/association_matcher_test.rb +258 -0
- data/test/matchers/ensure_inclusion_of_matcher_test.rb +80 -0
- data/test/matchers/ensure_length_of_matcher_test.rb +158 -0
- data/test/matchers/have_db_column_matcher_test.rb +169 -0
- data/test/matchers/have_index_matcher_test.rb +74 -0
- data/test/matchers/have_named_scope_matcher_test.rb +65 -0
- data/test/matchers/have_readonly_attributes_matcher_test.rb +29 -0
- data/test/matchers/validate_acceptance_of_matcher_test.rb +44 -0
- data/test/matchers/validate_numericality_of_matcher_test.rb +52 -0
- data/test/matchers/validate_presence_of_matcher_test.rb +86 -0
- data/test/matchers/validate_uniqueness_of_matcher_test.rb +141 -0
- data/test/model_builder.rb +61 -0
- data/test/other/autoload_macro_test.rb +18 -0
- data/test/other/helpers_test.rb +58 -0
- data/test/other/private_helpers_test.rb +1 -1
- data/test/other/should_test.rb +16 -16
- data/test/rails_root/app/controllers/posts_controller.rb +6 -5
- data/test/rails_root/app/models/pets/dog.rb +10 -0
- data/test/rails_root/app/models/treat.rb +3 -0
- data/test/rails_root/app/models/user.rb +2 -2
- data/test/rails_root/app/views/layouts/posts.rhtml +2 -0
- data/test/rails_root/config/database.yml +1 -1
- data/test/rails_root/config/environments/{sqlite3.rb → test.rb} +0 -0
- data/test/rails_root/db/migrate/001_create_users.rb +3 -2
- data/test/rails_root/db/migrate/011_create_treats.rb +12 -0
- data/test/rails_root/log/test.log +0 -0
- data/test/rails_root/test/shoulda_macros/custom_macro.rb +6 -0
- data/test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +6 -0
- data/test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +6 -0
- data/test/test_helper.rb +3 -1
- data/test/unit/address_test.rb +1 -1
- data/test/unit/dog_test.rb +5 -2
- data/test/unit/post_test.rb +7 -3
- data/test/unit/product_test.rb +2 -2
- data/test/unit/tag_test.rb +2 -1
- data/test/unit/user_test.rb +17 -8
- metadata +44 -4
- data/test/rails_root/app/models/dog.rb +0 -5
@@ -1,236 +1,233 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module Shoulda # :nodoc:
|
2
|
+
module Controller
|
3
|
+
# Formats tested by #should_be_restful. Defaults to [:html, :xml]
|
4
|
+
VALID_FORMATS = Dir.glob(File.join(File.dirname(__FILE__), 'formats', '*.rb')).map { |f| File.basename(f, '.rb') }.map(&:to_sym) # :doc:
|
5
|
+
VALID_FORMATS.each {|f| require "shoulda/controller/formats/#{f}"}
|
6
|
+
|
7
|
+
# Actions tested by #should_be_restful
|
8
|
+
VALID_ACTIONS = [:index, :show, :new, :edit, :create, :update, :destroy] # :doc:
|
9
|
+
|
10
|
+
# A ResourceOptions object is passed into should_be_restful in order to configure the tests for your controller.
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
# class UsersControllerTest < Test::Unit::TestCase
|
14
|
+
# fixtures :all
|
15
|
+
#
|
16
|
+
# def setup
|
17
|
+
# ...normal setup code...
|
18
|
+
# @user = User.find(:first)
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# should_be_restful do |resource|
|
22
|
+
# resource.identifier = :id
|
23
|
+
# resource.klass = User
|
24
|
+
# resource.object = :user
|
25
|
+
# resource.parent = []
|
26
|
+
# resource.actions = [:index, :show, :new, :edit, :update, :create, :destroy]
|
27
|
+
# resource.formats = [:html, :xml]
|
28
|
+
#
|
29
|
+
# resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13}
|
30
|
+
# resource.update.params = { :name => "sue" }
|
31
|
+
#
|
32
|
+
# resource.create.redirect = "user_url(@user)"
|
33
|
+
# resource.update.redirect = "user_url(@user)"
|
34
|
+
# resource.destroy.redirect = "users_url"
|
35
|
+
#
|
36
|
+
# resource.create.flash = /created/i
|
37
|
+
# resource.update.flash = /updated/i
|
38
|
+
# resource.destroy.flash = /removed/i
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# Whenever possible, the resource attributes will be set to sensible defaults.
|
43
|
+
#
|
44
|
+
class ResourceOptions
|
45
|
+
# Configuration options for the create, update, destroy actions under should_be_restful
|
46
|
+
class ActionOptions
|
47
|
+
# String evaled to get the target of the redirection.
|
48
|
+
# All of the instance variables set by the controller will be available to the
|
49
|
+
# evaled code.
|
50
|
+
#
|
51
|
+
# Example:
|
52
|
+
# resource.create.redirect = "user_url(@user.company, @user)"
|
53
|
+
#
|
54
|
+
# Defaults to a generated url based on the name of the controller, the action, and the resource.parents list.
|
55
|
+
attr_accessor :redirect
|
7
56
|
|
8
|
-
|
9
|
-
|
57
|
+
# String or Regexp describing a value expected in the flash. Will match against any flash key.
|
58
|
+
#
|
59
|
+
# Defaults:
|
60
|
+
# destroy:: /removed/
|
61
|
+
# create:: /created/
|
62
|
+
# update:: /updated/
|
63
|
+
attr_accessor :flash
|
64
|
+
|
65
|
+
# Hash describing the params that should be sent in with this action.
|
66
|
+
attr_accessor :params
|
67
|
+
end
|
10
68
|
|
11
|
-
#
|
69
|
+
# Configuration options for the denied actions under should_be_restful
|
12
70
|
#
|
13
71
|
# Example:
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# def setup
|
18
|
-
# ...normal setup code...
|
19
|
-
# @user = User.find(:first)
|
72
|
+
# context "The public" do
|
73
|
+
# setup do
|
74
|
+
# @request.session[:logged_in] = false
|
20
75
|
# end
|
21
76
|
#
|
22
77
|
# should_be_restful do |resource|
|
23
|
-
# resource.
|
24
|
-
# resource.klass = User
|
25
|
-
# resource.object = :user
|
26
|
-
# resource.parent = []
|
27
|
-
# resource.actions = [:index, :show, :new, :edit, :update, :create, :destroy]
|
28
|
-
# resource.formats = [:html, :xml]
|
29
|
-
#
|
30
|
-
# resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13}
|
31
|
-
# resource.update.params = { :name => "sue" }
|
78
|
+
# resource.parent = :user
|
32
79
|
#
|
33
|
-
# resource.
|
34
|
-
# resource.
|
35
|
-
# resource.
|
36
|
-
#
|
37
|
-
# resource.create.flash = /created/i
|
38
|
-
# resource.update.flash = /updated/i
|
39
|
-
# resource.destroy.flash = /removed/i
|
80
|
+
# resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy]
|
81
|
+
# resource.denied.flash = /get outta here/i
|
82
|
+
# resource.denied.redirect = 'new_session_url'
|
40
83
|
# end
|
41
84
|
# end
|
42
85
|
#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
#
|
47
|
-
class ActionOptions
|
48
|
-
# String evaled to get the target of the redirection.
|
49
|
-
# All of the instance variables set by the controller will be available to the
|
50
|
-
# evaled code.
|
51
|
-
#
|
52
|
-
# Example:
|
53
|
-
# resource.create.redirect = "user_url(@user.company, @user)"
|
54
|
-
#
|
55
|
-
# Defaults to a generated url based on the name of the controller, the action, and the resource.parents list.
|
56
|
-
attr_accessor :redirect
|
57
|
-
|
58
|
-
# String or Regexp describing a value expected in the flash. Will match against any flash key.
|
59
|
-
#
|
60
|
-
# Defaults:
|
61
|
-
# destroy:: /removed/
|
62
|
-
# create:: /created/
|
63
|
-
# update:: /updated/
|
64
|
-
attr_accessor :flash
|
65
|
-
|
66
|
-
# Hash describing the params that should be sent in with this action.
|
67
|
-
attr_accessor :params
|
68
|
-
end
|
69
|
-
|
70
|
-
# Configuration options for the denied actions under should_be_restful
|
86
|
+
class DeniedOptions
|
87
|
+
# String evaled to get the target of the redirection.
|
88
|
+
# All of the instance variables set by the controller will be available to the
|
89
|
+
# evaled code.
|
71
90
|
#
|
72
91
|
# Example:
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
#
|
77
|
-
#
|
78
|
-
# should_be_restful do |resource|
|
79
|
-
# resource.parent = :user
|
80
|
-
#
|
81
|
-
# resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy]
|
82
|
-
# resource.denied.flash = /get outta here/i
|
83
|
-
# resource.denied.redirect = 'new_session_url'
|
84
|
-
# end
|
85
|
-
# end
|
86
|
-
#
|
87
|
-
class DeniedOptions
|
88
|
-
# String evaled to get the target of the redirection.
|
89
|
-
# All of the instance variables set by the controller will be available to the
|
90
|
-
# evaled code.
|
91
|
-
#
|
92
|
-
# Example:
|
93
|
-
# resource.create.redirect = "user_url(@user.company, @user)"
|
94
|
-
attr_accessor :redirect
|
95
|
-
|
96
|
-
# String or Regexp describing a value expected in the flash. Will match against any flash key.
|
97
|
-
#
|
98
|
-
# Example:
|
99
|
-
# resource.create.flash = /created/
|
100
|
-
attr_accessor :flash
|
101
|
-
|
102
|
-
# Actions that should be denied (only used by resource.denied). <i>Note that these actions will
|
103
|
-
# only be tested if they are also listed in +resource.actions+</i>
|
104
|
-
# The special value of :all will deny all of the REST actions.
|
105
|
-
attr_accessor :actions
|
106
|
-
end
|
107
|
-
|
108
|
-
# Name of key in params that references the primary key.
|
109
|
-
# Will almost always be :id (default), unless you are using a plugin or have patched rails.
|
110
|
-
attr_accessor :identifier
|
111
|
-
|
112
|
-
# Name of the ActiveRecord class this resource is responsible for. Automatically determined from
|
113
|
-
# test class if not explicitly set. UserTest => "User"
|
114
|
-
attr_accessor :klass
|
115
|
-
|
116
|
-
# Name of the instantiated ActiveRecord object that should be used by some of the tests.
|
117
|
-
# Defaults to the underscored name of the AR class. CompanyManager => :company_manager
|
118
|
-
attr_accessor :object
|
119
|
-
|
120
|
-
# Name of the parent AR objects. Can be set as parent= or parents=, and can take either
|
121
|
-
# the name of the parent resource (if there's only one), or an array of names (if there's
|
122
|
-
# more than one).
|
92
|
+
# resource.create.redirect = "user_url(@user.company, @user)"
|
93
|
+
attr_accessor :redirect
|
94
|
+
|
95
|
+
# String or Regexp describing a value expected in the flash. Will match against any flash key.
|
123
96
|
#
|
124
97
|
# Example:
|
125
|
-
#
|
126
|
-
|
127
|
-
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
# # in the tests...
|
133
|
-
# class PeopleControllerTest < Test::Unit::TestCase
|
134
|
-
# should_be_restful do |resource|
|
135
|
-
# resource.parent = :companies
|
136
|
-
# end
|
137
|
-
# end
|
138
|
-
#
|
139
|
-
# class LimbsControllerTest < Test::Unit::TestCase
|
140
|
-
# should_be_restful do |resource|
|
141
|
-
# resource.parents = [:companies, :people]
|
142
|
-
# end
|
143
|
-
# end
|
144
|
-
attr_accessor :parent
|
145
|
-
alias parents parent
|
146
|
-
alias parents= parent=
|
147
|
-
|
148
|
-
# Actions that should be tested. Must be a subset of VALID_ACTIONS (default).
|
149
|
-
# Tests for each actionw will only be generated if the action is listed here.
|
150
|
-
# The special value of :all will test all of the REST actions.
|
151
|
-
#
|
152
|
-
# Example (for a read-only controller):
|
153
|
-
# resource.actions = [:show, :index]
|
98
|
+
# resource.create.flash = /created/
|
99
|
+
attr_accessor :flash
|
100
|
+
|
101
|
+
# Actions that should be denied (only used by resource.denied). <i>Note that these actions will
|
102
|
+
# only be tested if they are also listed in +resource.actions+</i>
|
103
|
+
# The special value of :all will deny all of the REST actions.
|
154
104
|
attr_accessor :actions
|
105
|
+
end
|
155
106
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
107
|
+
# Name of key in params that references the primary key.
|
108
|
+
# Will almost always be :id (default), unless you are using a plugin or have patched rails.
|
109
|
+
attr_accessor :identifier
|
110
|
+
|
111
|
+
# Name of the ActiveRecord class this resource is responsible for. Automatically determined from
|
112
|
+
# test class if not explicitly set. UserTest => "User"
|
113
|
+
attr_accessor :klass
|
114
|
+
|
115
|
+
# Name of the instantiated ActiveRecord object that should be used by some of the tests.
|
116
|
+
# Defaults to the underscored name of the AR class. CompanyManager => :company_manager
|
117
|
+
attr_accessor :object
|
118
|
+
|
119
|
+
# Name of the parent AR objects. Can be set as parent= or parents=, and can take either
|
120
|
+
# the name of the parent resource (if there's only one), or an array of names (if there's
|
121
|
+
# more than one).
|
122
|
+
#
|
123
|
+
# Example:
|
124
|
+
# # in the routes...
|
125
|
+
# map.resources :companies do
|
126
|
+
# map.resources :people do
|
127
|
+
# map.resources :limbs
|
128
|
+
# end
|
129
|
+
# end
|
130
|
+
#
|
131
|
+
# # in the tests...
|
132
|
+
# class PeopleControllerTest < Test::Unit::TestCase
|
133
|
+
# should_be_restful do |resource|
|
134
|
+
# resource.parent = :companies
|
135
|
+
# end
|
136
|
+
# end
|
137
|
+
#
|
138
|
+
# class LimbsControllerTest < Test::Unit::TestCase
|
139
|
+
# should_be_restful do |resource|
|
140
|
+
# resource.parents = [:companies, :people]
|
141
|
+
# end
|
142
|
+
# end
|
143
|
+
attr_accessor :parent
|
144
|
+
alias parents parent
|
145
|
+
alias parents= parent=
|
146
|
+
|
147
|
+
# Actions that should be tested. Must be a subset of VALID_ACTIONS (default).
|
148
|
+
# Tests for each actionw will only be generated if the action is listed here.
|
149
|
+
# The special value of :all will test all of the REST actions.
|
150
|
+
#
|
151
|
+
# Example (for a read-only controller):
|
152
|
+
# resource.actions = [:show, :index]
|
153
|
+
attr_accessor :actions
|
154
|
+
|
155
|
+
# Formats that should be tested. Must be a subset of VALID_FORMATS (default).
|
156
|
+
# Each action will be tested against the formats listed here. The special value
|
157
|
+
# of :all will test all of the supported formats.
|
158
|
+
#
|
159
|
+
# Example:
|
160
|
+
# resource.actions = [:html, :xml]
|
161
|
+
attr_accessor :formats
|
162
|
+
|
163
|
+
# ActionOptions object specifying options for the create action.
|
164
|
+
attr_accessor :create
|
165
|
+
|
166
|
+
# ActionOptions object specifying options for the update action.
|
167
|
+
attr_accessor :update
|
168
|
+
|
169
|
+
# ActionOptions object specifying options for the desrtoy action.
|
170
|
+
attr_accessor :destroy
|
171
|
+
|
172
|
+
# DeniedOptions object specifying which actions should return deny a request, and what should happen in that case.
|
173
|
+
attr_accessor :denied
|
174
|
+
|
175
|
+
def initialize # :nodoc:
|
176
|
+
@create = ActionOptions.new
|
177
|
+
@update = ActionOptions.new
|
178
|
+
@destroy = ActionOptions.new
|
179
|
+
@denied = DeniedOptions.new
|
180
|
+
|
181
|
+
@create.flash ||= /created/i
|
182
|
+
@update.flash ||= /updated/i
|
183
|
+
@destroy.flash ||= /removed/i
|
184
|
+
@denied.flash ||= /denied/i
|
185
|
+
|
186
|
+
@create.params ||= {}
|
187
|
+
@update.params ||= {}
|
188
|
+
|
189
|
+
@actions = VALID_ACTIONS
|
190
|
+
@formats = VALID_FORMATS
|
191
|
+
@denied.actions = []
|
192
|
+
end
|
193
|
+
|
194
|
+
def normalize!(target) # :nodoc:
|
195
|
+
@denied.actions = VALID_ACTIONS if @denied.actions == :all
|
196
|
+
@actions = VALID_ACTIONS if @actions == :all
|
197
|
+
@formats = VALID_FORMATS if @formats == :all
|
198
|
+
|
199
|
+
@denied.actions = @denied.actions.map(&:to_sym)
|
200
|
+
@actions = @actions.map(&:to_sym)
|
201
|
+
@formats = @formats.map(&:to_sym)
|
202
|
+
|
203
|
+
ensure_valid_members(@actions, VALID_ACTIONS, 'actions')
|
204
|
+
ensure_valid_members(@denied.actions, VALID_ACTIONS, 'denied.actions')
|
205
|
+
ensure_valid_members(@formats, VALID_FORMATS, 'formats')
|
206
|
+
|
207
|
+
@identifier ||= :id
|
208
|
+
@klass ||= target.name.gsub(/ControllerTest$/, '').singularize.constantize
|
209
|
+
@object ||= @klass.name.tableize.singularize
|
210
|
+
@parent ||= []
|
211
|
+
@parent = [@parent] unless @parent.is_a? Array
|
212
|
+
|
213
|
+
collection_helper = [@parent, @object.to_s.pluralize, 'url'].flatten.join('_')
|
214
|
+
collection_args = @parent.map {|n| "@#{object}.#{n}"}.join(', ')
|
215
|
+
@destroy.redirect ||= "#{collection_helper}(#{collection_args})"
|
216
|
+
|
217
|
+
member_helper = [@parent, @object, 'url'].flatten.join('_')
|
218
|
+
member_args = [@parent.map {|n| "@#{object}.#{n}"}, "@#{object}"].flatten.join(', ')
|
219
|
+
@create.redirect ||= "#{member_helper}(#{member_args})"
|
220
|
+
@update.redirect ||= "#{member_helper}(#{member_args})"
|
221
|
+
@denied.redirect ||= "new_session_url"
|
222
|
+
end
|
223
|
+
|
224
|
+
private
|
225
|
+
|
226
|
+
def ensure_valid_members(ary, valid_members, name) # :nodoc:
|
227
|
+
invalid = ary - valid_members
|
228
|
+
raise ArgumentError, "Unsupported #{name}: #{invalid.inspect}" unless invalid.empty?
|
231
229
|
end
|
232
230
|
end
|
233
231
|
end
|
234
232
|
end
|
235
233
|
|
236
|
-
|
data/lib/shoulda/helpers.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
puts("#{caller.first}: #{msg}")
|
7
|
-
end
|
1
|
+
module Shoulda # :nodoc:
|
2
|
+
module Helpers
|
3
|
+
# Prints a message to stdout, tagged with the name of the calling method.
|
4
|
+
def report!(msg = "")
|
5
|
+
puts("#{caller.first}: #{msg}")
|
8
6
|
end
|
9
7
|
end
|
10
8
|
end
|