formtastic-rails3 0.9.10.1 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +32 -16
- data/Rakefile +11 -11
- data/lib/formtastic.rb +95 -30
- data/lib/formtastic/railtie.rb +1 -1
- data/lib/formtastic/util.rb +3 -2
- data/lib/generators/formtastic/form/form_generator.rb +4 -4
- data/spec/buttons_spec.rb +1 -1
- data/spec/commit_button_spec.rb +1 -1
- data/spec/custom_builder_spec.rb +1 -1
- data/spec/defaults_spec.rb +1 -1
- data/spec/error_proc_spec.rb +1 -1
- data/spec/errors_spec.rb +1 -1
- data/spec/form_helper_spec.rb +1 -1
- data/spec/helpers/layout_helper_spec.rb +21 -0
- data/spec/i18n_spec.rb +1 -1
- data/spec/include_blank_spec.rb +1 -1
- data/spec/input_spec.rb +99 -93
- data/spec/inputs/boolean_input_spec.rb +1 -1
- data/spec/inputs/check_boxes_input_spec.rb +120 -6
- data/spec/inputs/country_input_spec.rb +1 -1
- data/spec/inputs/date_input_spec.rb +1 -1
- data/spec/inputs/datetime_input_spec.rb +1 -1
- data/spec/inputs/file_input_spec.rb +1 -1
- data/spec/inputs/hidden_input_spec.rb +1 -1
- data/spec/inputs/numeric_input_spec.rb +1 -1
- data/spec/inputs/password_input_spec.rb +1 -1
- data/spec/inputs/radio_input_spec.rb +61 -2
- data/spec/inputs/select_input_spec.rb +1 -1
- data/spec/inputs/string_input_spec.rb +36 -19
- data/spec/inputs/text_input_spec.rb +1 -1
- data/spec/inputs/time_input_spec.rb +24 -2
- data/spec/inputs/time_zone_input_spec.rb +1 -1
- data/spec/inputs_spec.rb +37 -2
- data/spec/label_spec.rb +42 -1
- data/spec/semantic_errors_spec.rb +1 -1
- data/spec/semantic_fields_for_spec.rb +1 -1
- data/spec/spec_helper.rb +15 -39
- data/spec/{custom_macros.rb → support/custom_macros.rb} +0 -7
- data/spec/support/output_buffer.rb +4 -0
- data/spec/support/test_environment.rb +45 -0
- metadata +20 -14
- data/spec/layout_helper_spec.rb +0 -31
@@ -259,13 +259,6 @@ module CustomMacros
|
|
259
259
|
output_buffer.replace '' # clears the output_buffer from the before block, hax!
|
260
260
|
end
|
261
261
|
|
262
|
-
it 'should not call find() on the parent class' do
|
263
|
-
::Author.should_not_receive(:find)
|
264
|
-
semantic_form_for(@new_post) do |builder|
|
265
|
-
concat(builder.input(:author, :as => as, :collection => @authors))
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
262
|
it 'should use the provided collection' do
|
270
263
|
form = semantic_form_for(@new_post) do |builder|
|
271
264
|
concat(builder.input(:author, :as => as, :collection => @authors))
|
@@ -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,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formtastic-rails3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: true
|
5
5
|
segments:
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 10
|
9
6
|
- 1
|
10
|
-
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- beta3
|
10
|
+
version: 1.0.0.beta3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rodrigo Alvarez
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-02 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -107,11 +107,11 @@ files:
|
|
107
107
|
- spec/buttons_spec.rb
|
108
108
|
- spec/commit_button_spec.rb
|
109
109
|
- spec/custom_builder_spec.rb
|
110
|
-
- spec/custom_macros.rb
|
111
110
|
- spec/defaults_spec.rb
|
112
111
|
- spec/error_proc_spec.rb
|
113
112
|
- spec/errors_spec.rb
|
114
113
|
- spec/form_helper_spec.rb
|
114
|
+
- spec/helpers/layout_helper_spec.rb
|
115
115
|
- spec/i18n_spec.rb
|
116
116
|
- spec/include_blank_spec.rb
|
117
117
|
- spec/input_spec.rb
|
@@ -132,16 +132,18 @@ files:
|
|
132
132
|
- spec/inputs/time_zone_input_spec.rb
|
133
133
|
- spec/inputs_spec.rb
|
134
134
|
- spec/label_spec.rb
|
135
|
-
- spec/layout_helper_spec.rb
|
136
135
|
- spec/semantic_errors_spec.rb
|
137
136
|
- spec/semantic_fields_for_spec.rb
|
138
137
|
- spec/spec.opts
|
139
138
|
- spec/spec_helper.rb
|
139
|
+
- spec/support/custom_macros.rb
|
140
|
+
- spec/support/output_buffer.rb
|
141
|
+
- spec/support/test_environment.rb
|
140
142
|
has_rdoc: true
|
141
143
|
homepage: http://github.com/Papipo/formtastic
|
142
144
|
licenses: []
|
143
145
|
|
144
|
-
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
|
146
|
+
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 All credit goes to the original author, Justin French.\n ========================================================================\n "
|
145
147
|
rdoc_options:
|
146
148
|
- --charset=UTF-8
|
147
149
|
require_paths:
|
@@ -155,11 +157,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
157
|
version: "0"
|
156
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
159
|
requirements:
|
158
|
-
- - "
|
160
|
+
- - ">"
|
159
161
|
- !ruby/object:Gem::Version
|
160
162
|
segments:
|
161
|
-
-
|
162
|
-
|
163
|
+
- 1
|
164
|
+
- 3
|
165
|
+
- 1
|
166
|
+
version: 1.3.1
|
163
167
|
requirements: []
|
164
168
|
|
165
169
|
rubyforge_project:
|
@@ -171,11 +175,11 @@ test_files:
|
|
171
175
|
- spec/buttons_spec.rb
|
172
176
|
- spec/commit_button_spec.rb
|
173
177
|
- spec/custom_builder_spec.rb
|
174
|
-
- spec/custom_macros.rb
|
175
178
|
- spec/defaults_spec.rb
|
176
179
|
- spec/error_proc_spec.rb
|
177
180
|
- spec/errors_spec.rb
|
178
181
|
- spec/form_helper_spec.rb
|
182
|
+
- spec/helpers/layout_helper_spec.rb
|
179
183
|
- spec/i18n_spec.rb
|
180
184
|
- spec/include_blank_spec.rb
|
181
185
|
- spec/input_spec.rb
|
@@ -196,7 +200,9 @@ test_files:
|
|
196
200
|
- spec/inputs/time_zone_input_spec.rb
|
197
201
|
- spec/inputs_spec.rb
|
198
202
|
- spec/label_spec.rb
|
199
|
-
- spec/layout_helper_spec.rb
|
200
203
|
- spec/semantic_errors_spec.rb
|
201
204
|
- spec/semantic_fields_for_spec.rb
|
202
205
|
- spec/spec_helper.rb
|
206
|
+
- spec/support/custom_macros.rb
|
207
|
+
- spec/support/output_buffer.rb
|
208
|
+
- spec/support/test_environment.rb
|
data/spec/layout_helper_spec.rb
DELETED
@@ -1,31 +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
|
-
@tags = concat(formtastic_stylesheet_link_tag())
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should render a link to formtastic.css' do
|
20
|
-
output_buffer.concat(@tags) if Formtastic::Util.rails3?
|
21
|
-
output_buffer.should have_tag("link[@href='/stylesheets/formtastic.css']")
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should render a link to formtastic_changes.css' do
|
25
|
-
output_buffer.concat(@tags) if Formtastic::Util.rails3?
|
26
|
-
output_buffer.should have_tag("link[@href='/stylesheets/formtastic_changes.css']")
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|