merb-helpers 1.0.15 → 1.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -5
- data/Rakefile +56 -64
- data/lib/merb-helpers/core_ext/numeric.rb +3 -2
- data/lib/merb-helpers/core_ext.rb +2 -1
- data/lib/merb-helpers/date_time_formatting.rb +1 -1
- data/lib/merb-helpers/date_time_helpers.rb +18 -18
- data/lib/merb-helpers/form/builder.rb +14 -10
- data/lib/merb-helpers/form/helpers.rb +1 -1
- data/lib/merb-helpers/form_helpers.rb +5 -2
- data/lib/merb-helpers/version.rb +5 -0
- data/lib/merb-helpers.rb +5 -3
- data/spec/core_ext_spec.rb +1 -1
- data/spec/fixture/app/models/namespaced_generic_fake_model.rb +7 -0
- data/spec/fixture/app/views/bound_radio_group_specs/basic.html.erb +1 -1
- data/spec/fixture/app/views/bound_radio_group_specs/mixed.html.erb +2 -2
- data/spec/fixture/app/views/form_for_specs/advanced.html.erb +3 -0
- data/spec/fixture/app/views/hacker/radio_group.html.erb +1 -1
- data/spec/fixture/config/router.rb +4 -4
- data/spec/merb_helpers_date_time_spec.rb +11 -3
- data/spec/merb_helpers_form_spec.rb +41 -18
- data/spec/merb_helpers_tag_helper_spec.rb +1 -1
- data/spec/merb_helpers_text_spec.rb +1 -1
- data/spec/numeric_extlib_spec.rb +2 -1
- data/spec/ordinalize_spec.rb +1 -1
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +17 -16
- data/spec/time_dsl_spec.rb +1 -1
- metadata +54 -23
- data/spec/merb_helpers_config_spec.rb +0 -82
- data/spec/merb_test.log +0 -504
data/spec/ordinalize_spec.rb
CHANGED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
# Use current merb-core sources if running from a typical dev checkout.
|
4
|
+
lib = File.expand_path('../../../merb-core/lib', __FILE__)
|
5
|
+
$LOAD_PATH.unshift(lib) if File.directory?(lib)
|
6
|
+
require 'merb-core'
|
7
|
+
|
8
|
+
# The lib under test
|
9
|
+
require "merb-helpers"
|
10
|
+
|
11
|
+
# Satisfies Autotest and anyone else not using the Rake tasks
|
12
|
+
require 'spec'
|
13
|
+
|
5
14
|
require "date"
|
6
15
|
require "webrat"
|
7
16
|
|
17
|
+
|
8
18
|
# Please read merb_helpers_form_spec.rb
|
9
19
|
# for more info on how to test helpers
|
10
20
|
# full stack specs are required
|
@@ -17,22 +27,13 @@ default_options = {
|
|
17
27
|
:merb_root => File.dirname(__FILE__) / 'fixture',
|
18
28
|
:log_file => File.dirname(__FILE__) / "merb_test.log"
|
19
29
|
}
|
30
|
+
|
20
31
|
options = default_options.merge($START_OPTIONS || {})
|
21
32
|
|
33
|
+
|
22
34
|
Merb.disable(:initfile)
|
23
35
|
Merb.start_environment(options)
|
24
36
|
|
25
|
-
def unload_merb_helpers
|
26
|
-
Merb.class_eval do
|
27
|
-
remove_const("Helpers") if defined?(Merb::Helpers)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def reload_merb_helpers
|
32
|
-
unload_merb_helpers
|
33
|
-
load(MERB_HELPERS_ROOT + "/lib/merb-helpers.rb")
|
34
|
-
Merb::Helpers.load
|
35
|
-
end
|
36
37
|
|
37
38
|
class FakeErrors
|
38
39
|
|
@@ -44,6 +45,8 @@ class FakeErrors
|
|
44
45
|
name.to_s.include?("bad")
|
45
46
|
end
|
46
47
|
|
48
|
+
alias :[] :on
|
49
|
+
|
47
50
|
end
|
48
51
|
|
49
52
|
class FakeColumn
|
@@ -56,8 +59,6 @@ class FakeColumn
|
|
56
59
|
end
|
57
60
|
|
58
61
|
|
59
|
-
|
60
|
-
|
61
62
|
# -- Global custom matchers --
|
62
63
|
|
63
64
|
# A better +be_kind_of+ with more informative error messages.
|
data/spec/time_dsl_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- pre
|
10
|
+
version: 1.1.0.pre
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Michael D. Ivey
|
@@ -9,36 +15,56 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-02-25 00:00:00 +01:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: merb-core
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - ~>
|
22
27
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
25
|
-
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
- pre
|
33
|
+
version: 1.1.0.pre
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 2
|
46
|
+
- 9
|
47
|
+
version: 1.2.9
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
description: Merb plugin containing view helpers
|
26
51
|
email: ivey@gweezlebur.com
|
27
52
|
executables: []
|
28
53
|
|
29
54
|
extensions: []
|
30
55
|
|
31
56
|
extra_rdoc_files:
|
32
|
-
- README
|
33
57
|
- LICENSE
|
58
|
+
- README
|
34
59
|
- TODO
|
35
60
|
files:
|
36
61
|
- LICENSE
|
37
62
|
- README
|
38
63
|
- Rakefile
|
39
64
|
- TODO
|
40
|
-
- lib/merb-helpers
|
65
|
+
- lib/merb-helpers.rb
|
41
66
|
- lib/merb-helpers/core_ext.rb
|
67
|
+
- lib/merb-helpers/core_ext/numeric.rb
|
42
68
|
- lib/merb-helpers/date_time_formatting.rb
|
43
69
|
- lib/merb-helpers/date_time_helpers.rb
|
44
70
|
- lib/merb-helpers/form/builder.rb
|
@@ -47,7 +73,7 @@ files:
|
|
47
73
|
- lib/merb-helpers/tag_helpers.rb
|
48
74
|
- lib/merb-helpers/text_helpers.rb
|
49
75
|
- lib/merb-helpers/time_dsl.rb
|
50
|
-
- lib/merb-helpers.rb
|
76
|
+
- lib/merb-helpers/version.rb
|
51
77
|
- spec/core_ext_spec.rb
|
52
78
|
- spec/fixture/app/controllers/application.rb
|
53
79
|
- spec/fixture/app/controllers/bound_check_box.rb
|
@@ -91,6 +117,7 @@ files:
|
|
91
117
|
- spec/fixture/app/models/fake_dm_model.rb
|
92
118
|
- spec/fixture/app/models/first_generic_fake_model.rb
|
93
119
|
- spec/fixture/app/models/hacker_generic_model.rb
|
120
|
+
- spec/fixture/app/models/namespaced_generic_fake_model.rb
|
94
121
|
- spec/fixture/app/models/second_generic_fake_model.rb
|
95
122
|
- spec/fixture/app/models/third_generic_fake_model.rb
|
96
123
|
- spec/fixture/app/views/bound_check_box_specs/basic.html.erb
|
@@ -161,6 +188,7 @@ files:
|
|
161
188
|
- spec/fixture/app/views/file_field_specs/with_label.html.erb
|
162
189
|
- spec/fixture/app/views/file_field_specs/with_values.html.erb
|
163
190
|
- spec/fixture/app/views/foo/bar.html.erb
|
191
|
+
- spec/fixture/app/views/form_for_specs/advanced.html.erb
|
164
192
|
- spec/fixture/app/views/form_for_specs/basic.html.erb
|
165
193
|
- spec/fixture/app/views/form_specs/create_a_form.html.erb
|
166
194
|
- spec/fixture/app/views/form_specs/create_a_multipart_form.html.erb
|
@@ -245,43 +273,46 @@ files:
|
|
245
273
|
- spec/fixture/public/images/merb.jpg
|
246
274
|
- spec/fixture/public/merb.fcgi
|
247
275
|
- spec/fixture/public/stylesheets/master.css
|
248
|
-
- spec/merb_helpers_config_spec.rb
|
249
276
|
- spec/merb_helpers_date_time_spec.rb
|
250
277
|
- spec/merb_helpers_form_spec.rb
|
251
278
|
- spec/merb_helpers_tag_helper_spec.rb
|
252
279
|
- spec/merb_helpers_text_spec.rb
|
253
|
-
- spec/merb_test.log
|
254
280
|
- spec/numeric_extlib_spec.rb
|
255
281
|
- spec/ordinalize_spec.rb
|
282
|
+
- spec/spec.opts
|
256
283
|
- spec/spec_helper.rb
|
257
284
|
- spec/time_dsl_spec.rb
|
258
285
|
has_rdoc: true
|
259
|
-
homepage: http://merbivore.com
|
286
|
+
homepage: http://merbivore.com/
|
260
287
|
licenses: []
|
261
288
|
|
262
289
|
post_install_message:
|
263
|
-
rdoc_options:
|
264
|
-
|
290
|
+
rdoc_options:
|
291
|
+
- --charset=UTF-8
|
265
292
|
require_paths:
|
266
293
|
- lib
|
267
294
|
required_ruby_version: !ruby/object:Gem::Requirement
|
268
295
|
requirements:
|
269
296
|
- - ">="
|
270
297
|
- !ruby/object:Gem::Version
|
298
|
+
segments:
|
299
|
+
- 0
|
271
300
|
version: "0"
|
272
|
-
version:
|
273
301
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
302
|
requirements:
|
275
|
-
- - "
|
303
|
+
- - ">"
|
276
304
|
- !ruby/object:Gem::Version
|
277
|
-
|
278
|
-
|
305
|
+
segments:
|
306
|
+
- 1
|
307
|
+
- 3
|
308
|
+
- 1
|
309
|
+
version: 1.3.1
|
279
310
|
requirements: []
|
280
311
|
|
281
|
-
rubyforge_project:
|
282
|
-
rubygems_version: 1.3.
|
312
|
+
rubyforge_project:
|
313
|
+
rubygems_version: 1.3.6
|
283
314
|
signing_key:
|
284
315
|
specification_version: 3
|
285
|
-
summary:
|
316
|
+
summary: Merb plugin that provides helpers for writing HTML templates
|
286
317
|
test_files: []
|
287
318
|
|
@@ -1,82 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
FIXTURES_DIR = File.dirname(__FILE__) + '/fixtures'
|
3
|
-
MERB_HELPERS_ROOT = File.dirname(__FILE__) + "/.."
|
4
|
-
|
5
|
-
describe "loading configuration" do
|
6
|
-
|
7
|
-
before :each do
|
8
|
-
unload_merb_helpers
|
9
|
-
end
|
10
|
-
|
11
|
-
after :all do
|
12
|
-
reload_merb_helpers
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should not have any helper available now" do
|
16
|
-
unload_merb_helpers
|
17
|
-
defined?(Merb::Helpers).should be_nil
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should load reload_merb_helpers" do
|
21
|
-
unload_merb_helpers
|
22
|
-
reload_merb_helpers
|
23
|
-
defined?(Merb::Helpers).should_not be_nil
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should load all helpers by default" do
|
27
|
-
reload_merb_helpers
|
28
|
-
defined?(Merb::Helpers).should_not be_nil
|
29
|
-
defined?(Merb::Helpers::Form).should_not be_nil
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should load all helpers by default" do
|
33
|
-
Merb::Plugins.should_receive(:config).any_number_of_times.and_return({})
|
34
|
-
reload_merb_helpers
|
35
|
-
defined?(Merb::Helpers).should_not be_nil
|
36
|
-
defined?(Merb::Helpers::DateAndTime).should_not be_nil
|
37
|
-
defined?(Merb::Helpers::Form)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should only load the helpers specified in the config hash (if defined)" do
|
41
|
-
unload_merb_helpers
|
42
|
-
defined?(Merb::Helpers).should be_nil
|
43
|
-
defined?(Merb::Helpers::DateAndTime).should be_nil
|
44
|
-
Merb::Plugins.stub!(:config).and_return(:merb_helpers => {:include => "form_helpers"})
|
45
|
-
reload_merb_helpers
|
46
|
-
defined?(Merb::Helpers).should_not be_nil
|
47
|
-
defined?(Merb::Helpers::Form).should_not be_nil
|
48
|
-
defined?(Merb::Helpers::DateAndTime).should be_nil
|
49
|
-
|
50
|
-
unload_merb_helpers
|
51
|
-
defined?(Merb::Helpers).should be_nil
|
52
|
-
defined?(Merb::Helpers::DateAndTime).should be_nil
|
53
|
-
Merb::Plugins.stub!(:config).and_return(:merb_helpers => {:include => ["form_helpers", "date_time_helpers"]})
|
54
|
-
reload_merb_helpers
|
55
|
-
defined?(Merb::Helpers).should_not be_nil
|
56
|
-
defined?(Merb::Helpers::Form).should_not be_nil
|
57
|
-
defined?(Merb::Helpers::DateAndTime).should_not be_nil
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should load all helpers if the include hash is empty" do
|
61
|
-
unload_merb_helpers
|
62
|
-
defined?(Merb::Helpers).should be_nil
|
63
|
-
defined?(Merb::Helpers::DateAndTime).should be_nil
|
64
|
-
Merb::Plugins.stub!(:config).and_return(:merb_helpers => {:include => ""})
|
65
|
-
reload_merb_helpers
|
66
|
-
defined?(Merb::Helpers).should_not be_nil
|
67
|
-
defined?(Merb::Helpers::Form).should_not be_nil
|
68
|
-
defined?(Merb::Helpers::DateAndTime).should_not be_nil
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should load helpers if the plugin conf is defined but the include pair is missing" do
|
72
|
-
unload_merb_helpers
|
73
|
-
defined?(Merb::Helpers).should be_nil
|
74
|
-
defined?(Merb::Helpers::DateAndTime).should be_nil
|
75
|
-
Merb::Plugins.stub!(:config).and_return(:merb_helpers => {})
|
76
|
-
reload_merb_helpers
|
77
|
-
defined?(Merb::Helpers).should_not be_nil
|
78
|
-
defined?(Merb::Helpers::Form).should_not be_nil
|
79
|
-
defined?(Merb::Helpers::DateAndTime).should_not be_nil
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|