formtastic 1.0.1 → 1.1.0.beta
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/README.textile +2 -2
- data/Rakefile +33 -8
- data/generators/formtastic/templates/formtastic.css +3 -18
- data/init.rb +5 -0
- data/lib/formtastic.rb +180 -82
- data/lib/formtastic/i18n.rb +8 -9
- data/lib/formtastic/layout_helper.rb +0 -1
- data/lib/formtastic/railtie.rb +12 -0
- data/lib/formtastic/util.rb +7 -0
- data/lib/generators/formtastic/form/form_generator.rb +86 -0
- data/lib/generators/formtastic/install/install_generator.rb +24 -0
- data/rails/init.rb +1 -6
- data/spec/buttons_spec.rb +25 -8
- data/spec/commit_button_spec.rb +67 -29
- data/spec/custom_builder_spec.rb +40 -4
- data/spec/defaults_spec.rb +1 -1
- data/spec/error_proc_spec.rb +1 -1
- data/spec/errors_spec.rb +3 -2
- data/spec/form_helper_spec.rb +33 -17
- data/spec/helpers/layout_helper_spec.rb +21 -0
- data/spec/i18n_spec.rb +13 -9
- data/spec/include_blank_spec.rb +9 -5
- data/spec/input_spec.rb +188 -48
- data/spec/inputs/boolean_input_spec.rb +14 -7
- data/spec/inputs/check_boxes_input_spec.rb +150 -20
- data/spec/inputs/country_input_spec.rb +9 -5
- data/spec/inputs/date_input_spec.rb +21 -9
- data/spec/inputs/datetime_input_spec.rb +33 -14
- data/spec/inputs/file_input_spec.rb +4 -3
- data/spec/inputs/hidden_input_spec.rb +11 -4
- data/spec/inputs/numeric_input_spec.rb +3 -3
- data/spec/inputs/password_input_spec.rb +3 -3
- data/spec/inputs/radio_input_spec.rb +29 -10
- data/spec/inputs/select_input_spec.rb +66 -26
- data/spec/inputs/string_input_spec.rb +5 -4
- data/spec/inputs/text_input_spec.rb +4 -3
- data/spec/inputs/time_input_spec.rb +26 -10
- data/spec/inputs/time_zone_input_spec.rb +11 -5
- data/spec/inputs_spec.rb +103 -39
- data/spec/label_spec.rb +5 -3
- data/spec/semantic_errors_spec.rb +7 -7
- data/spec/semantic_fields_for_spec.rb +5 -4
- data/spec/spec_helper.rb +86 -38
- data/spec/{custom_macros.rb → support/custom_macros.rb} +69 -35
- data/spec/support/output_buffer.rb +4 -0
- data/spec/support/test_environment.rb +45 -0
- metadata +26 -28
- data/spec/layout_helper_spec.rb +0 -29
@@ -0,0 +1,45 @@
|
|
1
|
+
if Formtastic::Util.rails3?
|
2
|
+
gem 'rspec', '~> 2.0.0.beta19'
|
3
|
+
gem 'rspec-rails', '~> 2.0.0.beta19'
|
4
|
+
gem 'rspec_tag_matchers'
|
5
|
+
gem 'i18n', '>= 0.4.0'
|
6
|
+
|
7
|
+
require "rubygems"
|
8
|
+
require "action_controller/railtie"
|
9
|
+
require "active_resource/railtie"
|
10
|
+
require 'active_model'
|
11
|
+
require 'rspec/core'
|
12
|
+
require 'rspec/rails'
|
13
|
+
require 'rspec_tag_matchers'
|
14
|
+
|
15
|
+
# Create a simple rails application for use in testing the viewhelper
|
16
|
+
module FormtasticTest
|
17
|
+
class Application < Rails::Application
|
18
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
19
|
+
config.encoding = "utf-8"
|
20
|
+
config.active_support.deprecation = :stderr
|
21
|
+
end
|
22
|
+
end
|
23
|
+
FormtasticTest::Application.initialize!
|
24
|
+
|
25
|
+
# Configure RSpec 2.0
|
26
|
+
RSpec.configure do |config|
|
27
|
+
config.include RspecTagMatchers
|
28
|
+
config.include CustomMacros
|
29
|
+
config.mock_with :rspec
|
30
|
+
end
|
31
|
+
|
32
|
+
else
|
33
|
+
gem 'rspec', '>= 1.2.6'
|
34
|
+
gem 'rspec-rails', '>= 1.2.6'
|
35
|
+
gem 'rspec_tag_matchers'
|
36
|
+
gem 'hpricot', '>= 0.6.1'
|
37
|
+
gem 'i18n', '< 0.4.0'
|
38
|
+
|
39
|
+
require 'rspec_tag_matchers'
|
40
|
+
|
41
|
+
Spec::Runner.configure do |config|
|
42
|
+
config.include(RspecTagMatchers)
|
43
|
+
config.include(CustomMacros)
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formtastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: true
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
- beta
|
10
|
+
version: 1.1.0.beta
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Justin French
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-28 00:00:00 +10:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -29,13 +30,6 @@ dependencies:
|
|
29
30
|
- 3
|
30
31
|
- 0
|
31
32
|
version: 2.3.0
|
32
|
-
- - <
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
segments:
|
35
|
-
- 3
|
36
|
-
- 0
|
37
|
-
- 0
|
38
|
-
version: 3.0.0
|
39
33
|
type: :runtime
|
40
34
|
version_requirements: *id001
|
41
35
|
- !ruby/object:Gem::Dependency
|
@@ -50,13 +44,6 @@ dependencies:
|
|
50
44
|
- 3
|
51
45
|
- 0
|
52
46
|
version: 2.3.0
|
53
|
-
- - <
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 3
|
57
|
-
- 0
|
58
|
-
- 0
|
59
|
-
version: 3.0.0
|
60
47
|
type: :runtime
|
61
48
|
version_requirements: *id002
|
62
49
|
- !ruby/object:Gem::Dependency
|
@@ -64,12 +51,13 @@ dependencies:
|
|
64
51
|
prerelease: false
|
65
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
66
53
|
requirements:
|
67
|
-
- -
|
54
|
+
- - ">="
|
68
55
|
- !ruby/object:Gem::Version
|
69
56
|
segments:
|
70
57
|
- 0
|
71
58
|
- 4
|
72
|
-
|
59
|
+
- 0
|
60
|
+
version: 0.4.0
|
73
61
|
type: :runtime
|
74
62
|
version_requirements: *id003
|
75
63
|
- !ruby/object:Gem::Dependency
|
@@ -121,20 +109,24 @@ files:
|
|
121
109
|
- generators/formtastic/templates/formtastic.rb
|
122
110
|
- generators/formtastic/templates/formtastic_changes.css
|
123
111
|
- generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb
|
112
|
+
- init.rb
|
124
113
|
- lib/formtastic.rb
|
125
114
|
- lib/formtastic/i18n.rb
|
126
115
|
- lib/formtastic/layout_helper.rb
|
116
|
+
- lib/formtastic/railtie.rb
|
127
117
|
- lib/formtastic/util.rb
|
118
|
+
- lib/generators/formtastic/form/form_generator.rb
|
119
|
+
- lib/generators/formtastic/install/install_generator.rb
|
128
120
|
- lib/locale/en.yml
|
129
121
|
- rails/init.rb
|
130
122
|
- spec/buttons_spec.rb
|
131
123
|
- spec/commit_button_spec.rb
|
132
124
|
- spec/custom_builder_spec.rb
|
133
|
-
- spec/custom_macros.rb
|
134
125
|
- spec/defaults_spec.rb
|
135
126
|
- spec/error_proc_spec.rb
|
136
127
|
- spec/errors_spec.rb
|
137
128
|
- spec/form_helper_spec.rb
|
129
|
+
- spec/helpers/layout_helper_spec.rb
|
138
130
|
- spec/i18n_spec.rb
|
139
131
|
- spec/include_blank_spec.rb
|
140
132
|
- spec/input_spec.rb
|
@@ -155,16 +147,18 @@ files:
|
|
155
147
|
- spec/inputs/time_zone_input_spec.rb
|
156
148
|
- spec/inputs_spec.rb
|
157
149
|
- spec/label_spec.rb
|
158
|
-
- spec/layout_helper_spec.rb
|
159
150
|
- spec/semantic_errors_spec.rb
|
160
151
|
- spec/semantic_fields_for_spec.rb
|
161
152
|
- spec/spec.opts
|
162
153
|
- spec/spec_helper.rb
|
154
|
+
- spec/support/custom_macros.rb
|
155
|
+
- spec/support/output_buffer.rb
|
156
|
+
- spec/support/test_environment.rb
|
163
157
|
has_rdoc: true
|
164
158
|
homepage: http://github.com/justinfrench/formtastic/tree/master
|
165
159
|
licenses: []
|
166
160
|
|
167
|
-
post_install_message: "\n ========================================================================\n Thanks for installing Formtastic!\n ------------------------------------------------------------------------\n You can now (optionally) run the generator to copy some stylesheets and\n a config initializer into your application:\n ./script/generate formtastic\n\n To generate some semantic form markup for your existing models, just run:\n ./script/generate form MODEL_NAME\n\n Find out more and get involved:\n http://github.com/justinfrench/formtastic\n http://groups.google.com.au/group/formtastic\n ========================================================================\n "
|
161
|
+
post_install_message: "\n ========================================================================\n Thanks for installing Formtastic!\n ------------------------------------------------------------------------\n You can now (optionally) run the generator to copy some stylesheets and\n a config initializer into your application:\n rails generator formastic:install # Rails 3\n ./script/generate formtastic # Rails 2\n\n To generate some semantic form markup for your existing models, just run:\n rails generate formtastic:form MODEL_NAME # Rails 3\n ./script/generate form MODEL_NAME # Rails 2\n\n Find out more and get involved:\n http://github.com/justinfrench/formtastic\n http://groups.google.com.au/group/formtastic\n ========================================================================\n "
|
168
162
|
rdoc_options:
|
169
163
|
- --charset=UTF-8
|
170
164
|
require_paths:
|
@@ -178,11 +172,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
172
|
version: "0"
|
179
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
174
|
requirements:
|
181
|
-
- - "
|
175
|
+
- - ">"
|
182
176
|
- !ruby/object:Gem::Version
|
183
177
|
segments:
|
184
|
-
-
|
185
|
-
|
178
|
+
- 1
|
179
|
+
- 3
|
180
|
+
- 1
|
181
|
+
version: 1.3.1
|
186
182
|
requirements: []
|
187
183
|
|
188
184
|
rubyforge_project:
|
@@ -194,11 +190,11 @@ test_files:
|
|
194
190
|
- spec/buttons_spec.rb
|
195
191
|
- spec/commit_button_spec.rb
|
196
192
|
- spec/custom_builder_spec.rb
|
197
|
-
- spec/custom_macros.rb
|
198
193
|
- spec/defaults_spec.rb
|
199
194
|
- spec/error_proc_spec.rb
|
200
195
|
- spec/errors_spec.rb
|
201
196
|
- spec/form_helper_spec.rb
|
197
|
+
- spec/helpers/layout_helper_spec.rb
|
202
198
|
- spec/i18n_spec.rb
|
203
199
|
- spec/include_blank_spec.rb
|
204
200
|
- spec/input_spec.rb
|
@@ -219,7 +215,9 @@ test_files:
|
|
219
215
|
- spec/inputs/time_zone_input_spec.rb
|
220
216
|
- spec/inputs_spec.rb
|
221
217
|
- spec/label_spec.rb
|
222
|
-
- spec/layout_helper_spec.rb
|
223
218
|
- spec/semantic_errors_spec.rb
|
224
219
|
- spec/semantic_fields_for_spec.rb
|
225
220
|
- spec/spec_helper.rb
|
221
|
+
- spec/support/custom_macros.rb
|
222
|
+
- spec/support/output_buffer.rb
|
223
|
+
- spec/support/test_environment.rb
|
data/spec/layout_helper_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe 'LayoutHelper' do
|
5
|
-
|
6
|
-
include FormtasticSpecHelper
|
7
|
-
include Formtastic::LayoutHelper
|
8
|
-
|
9
|
-
before do
|
10
|
-
@output_buffer = ''
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#formtastic_stylesheet_link_tag' do
|
14
|
-
|
15
|
-
before do
|
16
|
-
concat(formtastic_stylesheet_link_tag())
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should render a link to formtastic.css' do
|
20
|
-
output_buffer.should have_tag("link[@href='/stylesheets/formtastic.css']")
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should render a link to formtastic_changes.css' do
|
24
|
-
output_buffer.should have_tag("link[@href='/stylesheets/formtastic_changes.css']")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|