formtastic-bootstrap 1.2.0 → 2.0.0
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/Gemfile +5 -3
- data/Gemfile.lock +72 -60
- data/README.md +4 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/formtastic-bootstrap.gemspec +49 -16
- data/lib/formtastic-bootstrap/actions/base.rb +22 -0
- data/lib/formtastic-bootstrap/actions/button_action.rb +13 -0
- data/lib/formtastic-bootstrap/actions/input_action.rb +13 -0
- data/lib/formtastic-bootstrap/actions/link_action.rb +12 -0
- data/lib/formtastic-bootstrap/actions.rb +10 -0
- data/lib/formtastic-bootstrap/form_builder.rb +4 -2
- data/lib/formtastic-bootstrap/helpers/action_helper.rb +12 -0
- data/lib/formtastic-bootstrap/helpers/actions_helper.rb +24 -0
- data/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +2 -4
- data/lib/formtastic-bootstrap/helpers/inputs_helper.rb +0 -2
- data/lib/formtastic-bootstrap/helpers.rb +6 -8
- data/lib/formtastic-bootstrap/inputs/base/choices.rb +6 -35
- data/lib/formtastic-bootstrap/inputs/base/collections.rb +9 -0
- data/lib/formtastic-bootstrap/inputs/base/grouped_collections.rb +9 -0
- data/lib/formtastic-bootstrap/inputs/base/hints.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/base/labelling.rb +14 -3
- data/lib/formtastic-bootstrap/inputs/base/numeric.rb +9 -0
- data/lib/formtastic-bootstrap/inputs/base/stringish.rb +4 -5
- data/lib/formtastic-bootstrap/inputs/base/timeish.rb +38 -18
- data/lib/formtastic-bootstrap/inputs/base/wrapping.rb +22 -34
- data/lib/formtastic-bootstrap/inputs/base.rb +29 -6
- data/lib/formtastic-bootstrap/inputs/boolean_input.rb +14 -18
- data/lib/formtastic-bootstrap/inputs/check_boxes_input.rb +16 -11
- data/lib/formtastic-bootstrap/inputs/date_input.rb +3 -9
- data/lib/formtastic-bootstrap/inputs/date_select_input.rb +8 -0
- data/lib/formtastic-bootstrap/inputs/datetime_input.rb +3 -12
- data/lib/formtastic-bootstrap/inputs/datetime_select_input.rb +8 -0
- data/lib/formtastic-bootstrap/inputs/email_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/file_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/hidden_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/number_input.rb +3 -3
- data/lib/formtastic-bootstrap/inputs/password_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/phone_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/radio_input.rb +28 -14
- data/lib/formtastic-bootstrap/inputs/range_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/search_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/select_input.rb +3 -1
- data/lib/formtastic-bootstrap/inputs/string_input.rb +0 -7
- data/lib/formtastic-bootstrap/inputs/text_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/time_input.rb +3 -9
- data/lib/formtastic-bootstrap/inputs/time_select_input.rb +8 -0
- data/lib/formtastic-bootstrap/inputs/time_zone_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs/url_input.rb +1 -1
- data/lib/formtastic-bootstrap/inputs.rb +30 -23
- data/lib/formtastic-bootstrap.rb +16 -1
- data/spec/actions/button_action_spec.rb +63 -0
- data/spec/actions/input_action_spec.rb +59 -0
- data/spec/actions/link_action_spec.rb +92 -0
- data/spec/helpers/action_helper_spec.rb +368 -0
- data/spec/helpers/actions_helper_spec.rb +147 -0
- data/spec/helpers/input_helper_spec.rb +238 -259
- data/spec/helpers/inputs_helper_spec.rb +84 -25
- data/spec/inputs/boolean_input_spec.rb +108 -75
- data/spec/inputs/check_boxes_input_spec.rb +106 -91
- data/spec/inputs/date_select_input_spec.rb +164 -0
- data/spec/inputs/datetime_select_input_spec.rb +112 -0
- data/spec/inputs/deprecated_time_date_datetime_inputs_spec.rb +48 -0
- data/spec/inputs/email_input_spec.rb +30 -3
- data/spec/inputs/file_input_spec.rb +31 -4
- data/spec/inputs/hidden_input_spec.rb +63 -32
- data/spec/inputs/number_input_spec.rb +37 -8
- data/spec/inputs/password_input_spec.rb +30 -3
- data/spec/inputs/phone_input_spec.rb +30 -3
- data/spec/inputs/radio_input_spec.rb +87 -60
- data/spec/inputs/range_input_spec.rb +32 -5
- data/spec/inputs/search_input_spec.rb +29 -3
- data/spec/inputs/select_input_spec.rb +164 -107
- data/spec/inputs/string_input_spec.rb +33 -22
- data/spec/inputs/text_input_spec.rb +39 -14
- data/spec/inputs/time_select_input_spec.rb +191 -0
- data/spec/inputs/time_zone_input_spec.rb +17 -19
- data/spec/inputs/url_input_spec.rb +30 -3
- data/spec/spec_helper.rb +21 -15
- data/spec/support/custom_macros.rb +61 -228
- data/spec/support/fb_custom_macros.rb +23 -0
- metadata +109 -28
- data/lib/formtastic-bootstrap/helpers/buttons_helper.rb +0 -52
- data/spec/builder/errors_spec.rb +0 -214
- data/spec/helpers/buttons_helper_spec.rb +0 -149
- data/spec/inputs/date_input_spec.rb +0 -147
- data/spec/inputs/datetime_input_spec.rb +0 -101
- data/spec/inputs/time_input_spec.rb +0 -206
- data/spec/support/depracation.rb +0 -6
- data/spec/support/formtastic_spec_helper.rb +0 -382
@@ -1,382 +0,0 @@
|
|
1
|
-
# This was lifted right out of Formtastic.
|
2
|
-
module FormtasticSpecHelper
|
3
|
-
include ActionPack
|
4
|
-
include ActionView::Context if defined?(ActionView::Context)
|
5
|
-
include ActionController::RecordIdentifier
|
6
|
-
include ActionView::Helpers::FormHelper
|
7
|
-
include ActionView::Helpers::FormTagHelper
|
8
|
-
include ActionView::Helpers::FormOptionsHelper
|
9
|
-
include ActionView::Helpers::UrlHelper
|
10
|
-
include ActionView::Helpers::TagHelper
|
11
|
-
include ActionView::Helpers::TextHelper
|
12
|
-
include ActionView::Helpers::ActiveRecordHelper if defined?(ActionView::Helpers::ActiveRecordHelper)
|
13
|
-
include ActionView::Helpers::ActiveModelHelper if defined?(ActionView::Helpers::ActiveModelHelper)
|
14
|
-
include ActionView::Helpers::DateHelper
|
15
|
-
include ActionView::Helpers::TextFieldDateHelper # I added this!
|
16
|
-
include ActionView::Helpers::CaptureHelper
|
17
|
-
include ActionView::Helpers::AssetTagHelper
|
18
|
-
include ActiveSupport
|
19
|
-
include ActionController::PolymorphicRoutes if defined?(ActionController::PolymorphicRoutes)
|
20
|
-
|
21
|
-
include Formtastic::Helpers::FormHelper
|
22
|
-
|
23
|
-
def default_input_type(column_type, column_name = :generic_column_name)
|
24
|
-
@new_post.stub!(column_name)
|
25
|
-
@new_post.stub!(:column_for_attribute).and_return(mock('column', :type => column_type)) unless column_type.nil?
|
26
|
-
|
27
|
-
semantic_form_for(@new_post) do |builder|
|
28
|
-
@default_type = builder.send(:default_input_type, column_name)
|
29
|
-
end
|
30
|
-
|
31
|
-
return @default_type
|
32
|
-
end
|
33
|
-
|
34
|
-
def active_model_validator(kind, attributes, options = {})
|
35
|
-
validator = mock("ActiveModel::Validations::#{kind.to_s.titlecase}Validator", :attributes => attributes, :options => options)
|
36
|
-
validator.stub!(:kind).and_return(kind)
|
37
|
-
validator
|
38
|
-
end
|
39
|
-
|
40
|
-
def active_model_presence_validator(attributes, options = {})
|
41
|
-
active_model_validator(:presence, attributes, options)
|
42
|
-
end
|
43
|
-
|
44
|
-
def active_model_length_validator(attributes, options = {})
|
45
|
-
active_model_validator(:length, attributes, options)
|
46
|
-
end
|
47
|
-
|
48
|
-
def active_model_inclusion_validator(attributes, options = {})
|
49
|
-
active_model_validator(:inclusion, attributes, options)
|
50
|
-
end
|
51
|
-
|
52
|
-
def active_model_numericality_validator(attributes, options = {})
|
53
|
-
active_model_validator(:numericality, attributes, options)
|
54
|
-
end
|
55
|
-
|
56
|
-
class ::MongoPost
|
57
|
-
include MongoMapper::Document if defined?(MongoMapper::Document)
|
58
|
-
|
59
|
-
def id
|
60
|
-
end
|
61
|
-
|
62
|
-
def persisted?
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
class ::Post
|
68
|
-
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
69
|
-
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
70
|
-
|
71
|
-
def id
|
72
|
-
end
|
73
|
-
|
74
|
-
def persisted?
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
module ::Namespaced
|
79
|
-
class Post
|
80
|
-
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
81
|
-
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
82
|
-
|
83
|
-
def id
|
84
|
-
end
|
85
|
-
|
86
|
-
def persisted?
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class ::Author
|
92
|
-
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
93
|
-
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
94
|
-
|
95
|
-
def to_label
|
96
|
-
end
|
97
|
-
|
98
|
-
def persisted?
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
class ::HashBackedAuthor < Hash
|
103
|
-
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
104
|
-
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
105
|
-
def persisted?; false; end
|
106
|
-
def name
|
107
|
-
'hash backed author'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
class ::Continent
|
112
|
-
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
113
|
-
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
114
|
-
end
|
115
|
-
|
116
|
-
class ::PostModel
|
117
|
-
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
118
|
-
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
119
|
-
end
|
120
|
-
|
121
|
-
def _routes
|
122
|
-
url_helpers = mock('url_helpers')
|
123
|
-
url_helpers.stub!(:hash_for_posts_path).and_return({})
|
124
|
-
url_helpers.stub!(:hash_for_post_path).and_return({})
|
125
|
-
url_helpers.stub!(:hash_for_post_models_path).and_return({})
|
126
|
-
url_helpers.stub!(:hash_for_authors_path).and_return({})
|
127
|
-
|
128
|
-
mock('_routes',
|
129
|
-
:url_helpers => url_helpers,
|
130
|
-
:url_for => "/mock/path"
|
131
|
-
)
|
132
|
-
end
|
133
|
-
|
134
|
-
def controller
|
135
|
-
mock('controller', :controller_path= => '', :params => {})
|
136
|
-
end
|
137
|
-
|
138
|
-
def default_url_options
|
139
|
-
{}
|
140
|
-
end
|
141
|
-
|
142
|
-
def mock_everything
|
143
|
-
|
144
|
-
# Resource-oriented styles like form_for(@post) will expect a path method for the object,
|
145
|
-
# so we're defining some here.
|
146
|
-
def post_models_path(*args); "/postmodels/1"; end
|
147
|
-
|
148
|
-
def post_path(*args); "/posts/1"; end
|
149
|
-
def posts_path(*args); "/posts"; end
|
150
|
-
def new_post_path(*args); "/posts/new"; end
|
151
|
-
|
152
|
-
def author_path(*args); "/authors/1"; end
|
153
|
-
def authors_path(*args); "/authors"; end
|
154
|
-
def new_author_path(*args); "/authors/new"; end
|
155
|
-
|
156
|
-
@fred = ::Author.new
|
157
|
-
@fred.stub!(:class).and_return(::Author)
|
158
|
-
@fred.stub!(:to_label).and_return('Fred Smith')
|
159
|
-
@fred.stub!(:login).and_return('fred_smith')
|
160
|
-
@fred.stub!(:age).and_return(27)
|
161
|
-
@fred.stub!(:id).and_return(37)
|
162
|
-
@fred.stub!(:new_record?).and_return(false)
|
163
|
-
@fred.stub!(:errors).and_return(mock('errors', :[] => nil))
|
164
|
-
@fred.stub!(:to_key).and_return(nil)
|
165
|
-
@fred.stub!(:persisted?).and_return(nil)
|
166
|
-
@fred.stub!(:name).and_return('Fred')
|
167
|
-
|
168
|
-
@bob = ::Author.new
|
169
|
-
@bob.stub!(:to_label).and_return('Bob Rock')
|
170
|
-
@bob.stub!(:login).and_return('bob')
|
171
|
-
@bob.stub!(:age).and_return(43)
|
172
|
-
@bob.stub!(:created_at)
|
173
|
-
@bob.stub!(:id).and_return(42)
|
174
|
-
@bob.stub!(:posts).and_return([])
|
175
|
-
@bob.stub!(:post_ids).and_return([])
|
176
|
-
@bob.stub!(:new_record?).and_return(false)
|
177
|
-
@bob.stub!(:errors).and_return(mock('errors', :[] => nil))
|
178
|
-
@bob.stub!(:to_key).and_return(nil)
|
179
|
-
@bob.stub!(:persisted?).and_return(nil)
|
180
|
-
@bob.stub!(:name).and_return('Bob')
|
181
|
-
|
182
|
-
@james = ::Author.new
|
183
|
-
@james.stub!(:to_label).and_return('James Shock')
|
184
|
-
@james.stub!(:login).and_return('james')
|
185
|
-
@james.stub!(:age).and_return(38)
|
186
|
-
@james.stub!(:id).and_return(75)
|
187
|
-
@james.stub!(:posts).and_return([])
|
188
|
-
@james.stub!(:post_ids).and_return([])
|
189
|
-
@james.stub!(:new_record?).and_return(false)
|
190
|
-
@james.stub!(:errors).and_return(mock('errors', :[] => nil))
|
191
|
-
@james.stub!(:to_key).and_return(nil)
|
192
|
-
@james.stub!(:persisted?).and_return(nil)
|
193
|
-
@james.stub!(:name).and_return('James')
|
194
|
-
|
195
|
-
|
196
|
-
::Author.stub!(:scoped).and_return(::Author)
|
197
|
-
::Author.stub!(:find).and_return([@fred, @bob])
|
198
|
-
::Author.stub!(:all).and_return([@fred, @bob])
|
199
|
-
::Author.stub!(:where).and_return([@fred, @bob])
|
200
|
-
::Author.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
|
201
|
-
::Author.stub!(:human_name).and_return('::Author')
|
202
|
-
::Author.stub!(:reflect_on_association).and_return { |column_name| mock('reflection', :options => {}, :klass => Post, :macro => :has_many) if column_name == :posts }
|
203
|
-
::Author.stub!(:content_columns).and_return([mock('column', :name => 'login'), mock('column', :name => 'created_at')])
|
204
|
-
::Author.stub!(:to_key).and_return(nil)
|
205
|
-
::Author.stub!(:persisted?).and_return(nil)
|
206
|
-
|
207
|
-
@hash_backed_author = HashBackedAuthor.new
|
208
|
-
|
209
|
-
# Sometimes we need a mock @post object and some Authors for belongs_to
|
210
|
-
@new_post = mock('post')
|
211
|
-
@new_post.stub!(:class).and_return(::Post)
|
212
|
-
@new_post.stub!(:id).and_return(nil)
|
213
|
-
@new_post.stub!(:new_record?).and_return(true)
|
214
|
-
@new_post.stub!(:errors).and_return(mock('errors', :[] => nil))
|
215
|
-
@new_post.stub!(:author).and_return(nil)
|
216
|
-
@new_post.stub!(:author_attributes=).and_return(nil)
|
217
|
-
@new_post.stub!(:authors).and_return([@fred])
|
218
|
-
@new_post.stub!(:authors_attributes=)
|
219
|
-
@new_post.stub!(:reviewer).and_return(nil)
|
220
|
-
@new_post.stub!(:main_post).and_return(nil)
|
221
|
-
@new_post.stub!(:sub_posts).and_return([]) #TODO should be a mock with methods for adding sub posts
|
222
|
-
@new_post.stub!(:to_key).and_return(nil)
|
223
|
-
@new_post.stub!(:to_model).and_return(@new_post)
|
224
|
-
@new_post.stub!(:persisted?).and_return(nil)
|
225
|
-
|
226
|
-
@freds_post = mock('post')
|
227
|
-
@freds_post.stub!(:to_ary)
|
228
|
-
@freds_post.stub!(:class).and_return(::Post)
|
229
|
-
@freds_post.stub!(:to_label).and_return('Fred Smith')
|
230
|
-
@freds_post.stub!(:id).and_return(19)
|
231
|
-
@freds_post.stub!(:title).and_return("Hello World")
|
232
|
-
@freds_post.stub!(:author).and_return(@fred)
|
233
|
-
@freds_post.stub!(:author_id).and_return(@fred.id)
|
234
|
-
@freds_post.stub!(:authors).and_return([@fred])
|
235
|
-
@freds_post.stub!(:author_ids).and_return([@fred.id])
|
236
|
-
@freds_post.stub!(:new_record?).and_return(false)
|
237
|
-
@freds_post.stub!(:errors).and_return(mock('errors', :[] => nil))
|
238
|
-
@freds_post.stub!(:to_key).and_return(nil)
|
239
|
-
@freds_post.stub!(:persisted?).and_return(nil)
|
240
|
-
@fred.stub!(:posts).and_return([@freds_post])
|
241
|
-
@fred.stub!(:post_ids).and_return([@freds_post.id])
|
242
|
-
|
243
|
-
::Post.stub!(:scoped).and_return(::Post)
|
244
|
-
::Post.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
|
245
|
-
::Post.stub!(:human_name).and_return('Post')
|
246
|
-
::Post.stub!(:reflect_on_all_validations).and_return([])
|
247
|
-
::Post.stub!(:reflect_on_validations_for).and_return([])
|
248
|
-
::Post.stub!(:reflections).and_return({})
|
249
|
-
::Post.stub!(:reflect_on_association).and_return do |column_name|
|
250
|
-
case column_name
|
251
|
-
when :author, :author_status
|
252
|
-
mock = mock('reflection', :options => {}, :klass => ::Author, :macro => :belongs_to)
|
253
|
-
mock.stub!(:[]).with(:class_name).and_return("Author")
|
254
|
-
mock
|
255
|
-
when :reviewer
|
256
|
-
mock = mock('reflection', :options => {:class_name => 'Author'}, :klass => ::Author, :macro => :belongs_to)
|
257
|
-
mock.stub!(:[]).with(:class_name).and_return("Author")
|
258
|
-
mock
|
259
|
-
when :authors
|
260
|
-
mock('reflection', :options => {}, :klass => ::Author, :macro => :has_and_belongs_to_many)
|
261
|
-
when :sub_posts
|
262
|
-
mock('reflection', :options => {}, :klass => ::Post, :macro => :has_many)
|
263
|
-
when :main_post
|
264
|
-
mock('reflection', :options => {}, :klass => ::Post, :macro => :belongs_to)
|
265
|
-
when :mongoid_reviewer
|
266
|
-
mock('reflection', :options => nil, :klass => ::Author, :macro => :referenced_in, :foreign_key => "reviewer_id") # custom id
|
267
|
-
end
|
268
|
-
end
|
269
|
-
::Post.stub!(:find).and_return([@freds_post])
|
270
|
-
::Post.stub!(:all).and_return([@freds_post])
|
271
|
-
::Post.stub!(:where).and_return([@freds_post])
|
272
|
-
::Post.stub!(:content_columns).and_return([mock('column', :name => 'title'), mock('column', :name => 'body'), mock('column', :name => 'created_at')])
|
273
|
-
::Post.stub!(:to_key).and_return(nil)
|
274
|
-
::Post.stub!(:persisted?).and_return(nil)
|
275
|
-
::Post.stub!(:to_ary)
|
276
|
-
|
277
|
-
::MongoPost.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
|
278
|
-
::MongoPost.stub!(:human_name).and_return('MongoPost')
|
279
|
-
::MongoPost.stub!(:associations).and_return({
|
280
|
-
:sub_posts => mock('reflection', :options => {:polymorphic => true}, :klass => ::MongoPost, :macro => :has_many),
|
281
|
-
:options => []
|
282
|
-
})
|
283
|
-
::MongoPost.stub!(:find).and_return([@freds_post])
|
284
|
-
::MongoPost.stub!(:all).and_return([@freds_post])
|
285
|
-
::MongoPost.stub!(:where).and_return([@freds_post])
|
286
|
-
::MongoPost.stub!(:to_key).and_return(nil)
|
287
|
-
::MongoPost.stub!(:persisted?).and_return(nil)
|
288
|
-
::MongoPost.stub!(:to_ary)
|
289
|
-
::MongoPost.stub!(:model_name).and_return( mock(:model_name_mock, :singular => "post", :plural => "posts", :param_key => "post", :route_key => "posts") )
|
290
|
-
|
291
|
-
@new_mm_post = mock('mm_post')
|
292
|
-
@new_mm_post.stub!(:class).and_return(::MongoPost)
|
293
|
-
@new_mm_post.stub!(:id).and_return(nil)
|
294
|
-
@new_mm_post.stub!(:new_record?).and_return(true)
|
295
|
-
@new_mm_post.stub!(:errors).and_return(mock('errors', :[] => nil))
|
296
|
-
@new_mm_post.stub!(:title).and_return("Hello World")
|
297
|
-
@new_mm_post.stub!(:sub_posts).and_return([]) #TODO should be a mock with methods for adding sub posts
|
298
|
-
@new_mm_post.stub!(:to_key).and_return(nil)
|
299
|
-
@new_mm_post.stub!(:to_model).and_return(@new_mm_post)
|
300
|
-
@new_mm_post.stub!(:persisted?).and_return(nil)
|
301
|
-
|
302
|
-
@mock_file = mock('file')
|
303
|
-
Formtastic::FormBuilder.file_methods.each do |method|
|
304
|
-
@mock_file.stub!(method).and_return(true)
|
305
|
-
end
|
306
|
-
|
307
|
-
@new_post.stub!(:title)
|
308
|
-
@new_post.stub!(:email)
|
309
|
-
@new_post.stub!(:url)
|
310
|
-
@new_post.stub!(:phone)
|
311
|
-
@new_post.stub!(:search)
|
312
|
-
@new_post.stub!(:to_ary)
|
313
|
-
@new_post.stub!(:body)
|
314
|
-
@new_post.stub!(:published)
|
315
|
-
@new_post.stub!(:publish_at)
|
316
|
-
@new_post.stub!(:created_at)
|
317
|
-
@new_post.stub!(:secret).and_return(1)
|
318
|
-
@new_post.stub!(:url)
|
319
|
-
@new_post.stub!(:email)
|
320
|
-
@new_post.stub!(:search)
|
321
|
-
@new_post.stub!(:phone)
|
322
|
-
@new_post.stub!(:time_zone)
|
323
|
-
@new_post.stub!(:category_name)
|
324
|
-
@new_post.stub!(:allow_comments).and_return(true)
|
325
|
-
@new_post.stub!(:answer_comments)
|
326
|
-
@new_post.stub!(:country)
|
327
|
-
@new_post.stub!(:country_subdivision)
|
328
|
-
@new_post.stub!(:country_code)
|
329
|
-
@new_post.stub!(:document).and_return(@mock_file)
|
330
|
-
@new_post.stub!(:column_for_attribute).with(:meta_description).and_return(mock('column', :type => :string, :limit => 255))
|
331
|
-
@new_post.stub!(:column_for_attribute).with(:title).and_return(mock('column', :type => :string, :limit => 50))
|
332
|
-
@new_post.stub!(:column_for_attribute).with(:body).and_return(mock('column', :type => :text))
|
333
|
-
@new_post.stub!(:column_for_attribute).with(:published).and_return(mock('column', :type => :boolean))
|
334
|
-
@new_post.stub!(:column_for_attribute).with(:publish_at).and_return(mock('column', :type => :date))
|
335
|
-
@new_post.stub!(:column_for_attribute).with(:time_zone).and_return(mock('column', :type => :string))
|
336
|
-
@new_post.stub!(:column_for_attribute).with(:allow_comments).and_return(mock('column', :type => :boolean))
|
337
|
-
@new_post.stub!(:column_for_attribute).with(:author).and_return(mock('column', :type => :integer))
|
338
|
-
@new_post.stub!(:column_for_attribute).with(:country).and_return(mock('column', :type => :string, :limit => 255))
|
339
|
-
@new_post.stub!(:column_for_attribute).with(:country_subdivision).and_return(mock('column', :type => :string, :limit => 255))
|
340
|
-
@new_post.stub!(:column_for_attribute).with(:country_code).and_return(mock('column', :type => :string, :limit => 255))
|
341
|
-
@new_post.stub!(:column_for_attribute).with(:email).and_return(mock('column', :type => :string, :limit => 255))
|
342
|
-
@new_post.stub!(:column_for_attribute).with(:url).and_return(mock('column', :type => :string, :limit => 255))
|
343
|
-
@new_post.stub!(:column_for_attribute).with(:phone).and_return(mock('column', :type => :string, :limit => 255))
|
344
|
-
@new_post.stub!(:column_for_attribute).with(:search).and_return(mock('column', :type => :string, :limit => 255))
|
345
|
-
@new_post.stub!(:column_for_attribute).with(:document).and_return(nil)
|
346
|
-
|
347
|
-
@new_post.stub!(:author).and_return(@bob)
|
348
|
-
@new_post.stub!(:author_id).and_return(@bob.id)
|
349
|
-
|
350
|
-
@new_post.stub!(:reviewer).and_return(@fred)
|
351
|
-
@new_post.stub!(:reviewer_id).and_return(@fred.id)
|
352
|
-
|
353
|
-
@new_post.should_receive(:publish_at=).any_number_of_times
|
354
|
-
@new_post.should_receive(:title=).any_number_of_times
|
355
|
-
@new_post.stub!(:main_post_id).and_return(nil)
|
356
|
-
|
357
|
-
end
|
358
|
-
|
359
|
-
def self.included(base)
|
360
|
-
base.class_eval do
|
361
|
-
|
362
|
-
attr_accessor :output_buffer
|
363
|
-
|
364
|
-
def protect_against_forgery?
|
365
|
-
false
|
366
|
-
end
|
367
|
-
|
368
|
-
def _helpers
|
369
|
-
FakeHelpersModule
|
370
|
-
end
|
371
|
-
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
def with_config(config_method_name, value, &block)
|
376
|
-
old_value = FormtasticBootstrap::FormBuilder.send(config_method_name)
|
377
|
-
FormtasticBootstrap::FormBuilder.send(:"#{config_method_name}=", value)
|
378
|
-
yield
|
379
|
-
FormtasticBootstrap::FormBuilder.send(:"#{config_method_name}=", old_value)
|
380
|
-
end
|
381
|
-
|
382
|
-
end
|