Permalink
Browse files

Updated for debugger and new ClientSideValidations

  • Loading branch information...
1 parent ffe568c commit 774fbf986ae80458b4a99c3e7d631d83c21ed44c @bcardarella bcardarella committed Jul 9, 2012
View
@@ -2,11 +2,8 @@ source 'http://rubygems.org'
gemspec
-ruby_minor_version = RUBY_VERSION.split('.')[1].to_i
-if ruby_minor_version == 8
+if RUBY_VERSION >= '1.9.3'
+ gem 'debugger'
+elsif RUBY_VERSION < '1.9'
gem 'minitest'
- gem 'ruby-debug'
-elsif ruby_minor_version == 9
- gem 'ruby-debug19', :require => 'ruby-debug'
end
-
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ['lib']
gem.version = ClientSideValidations::Formtastic::VERSION
- gem.add_dependency 'client_side_validations', '~> 3.2.0.beta.1'
+ gem.add_dependency 'client_side_validations', '~> 3.2.0.beta.4'
gem.add_dependency 'formtastic', '~> 2.0.0'
gem.add_development_dependency 'rails', '~> 3.2.0'
@@ -4,9 +4,9 @@ module FormBuilder
def self.included(base)
base.class_eval do
- def self.client_side_form_settings(options, form_helper)
+ def client_side_form_settings(options, form_helper)
{
- :type => self.to_s,
+ :type => self.class.to_s,
:inline_error_class => ::Formtastic::FormBuilder.default_inline_error_class
}
end
View
@@ -5,4 +5,8 @@
require 'test/unit'
require 'mocha'
+if RUBY_VERSION >= '1.9.3'
+ require 'debugger'
+end
+
module ClientSideValidations; end
@@ -6,6 +6,7 @@ def test_client_side_form_js_hash
:type => 'Formtastic::FormBuilder',
:inline_error_class => 'inline-errors'
}
- assert_equal expected, Formtastic::FormBuilder.client_side_form_settings(nil, nil)
+ builder = Formtastic::FormBuilder.new(:user, nil, {}, {}, Proc.new {})
+ assert_equal expected, builder.client_side_form_settings(nil, nil)
end
end
@@ -14,7 +14,7 @@ def test_semantic_form_for
concat f.input(:cost)
end
- expected = %{<form accept-charset="UTF-8" action="/posts/123" class="formtastic post" data-validate="true" id="edit_post_123" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /></div><li class="string input required stringish" id="post_cost_input"><label class=\" label\" for="post_cost">Cost<abbr title="required">*</abbr></label><input data-validate="true" id="post_cost" name="post[cost]" type="text" />\n\n</li></form><script>window.ClientSideValidations.forms['edit_post_123'] = {"type":"Formtastic::FormBuilder","inline_error_class":"inline-errors","validators":{"post[cost]":{"presence":{"message":"can't be blank"}}}};</script>}
+ expected = %{<form accept-charset="UTF-8" action="/posts/123" class="formtastic post" data-validate="true" id="edit_post_123" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /></div><li class="string input required stringish" id="post_cost_input"><label class=\" label\" for="post_cost">Cost<abbr title="required">*</abbr></label><input data-validate="true" id="post_cost" name="post[cost]" type="text" />\n\n</li></form><script>//<![CDATA[\nwindow.ClientSideValidations.forms['edit_post_123'] = {"type":"Formtastic::FormBuilder","inline_error_class":"inline-errors","validators":{"post[cost]":{"presence":{"message":"can't be blank"}}}};\n//]]></script>}
assert_equal expected, output_buffer, "\n\n *** If you're running Ruby 1.8 and this test fails is is most likely due to 1.8's lack of insertion order persistence with Hashes ***\n"
end
@@ -23,7 +23,7 @@ def test_input_override
concat f.input(:cost, :validate => false)
end
- expected = %{<form accept-charset="UTF-8" action="/posts/123" class="formtastic post" data-validate="true" id="edit_post_123" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /></div><li class="string input required stringish" id="post_cost_input"><label class=\" label\" for="post_cost">Cost<abbr title="required">*</abbr></label><input id="post_cost" name="post[cost]" type="text" />\n\n</li></form><script>window.ClientSideValidations.forms['edit_post_123'] = {"type":"Formtastic::FormBuilder","inline_error_class":"inline-errors","validators":{}};</script>}
+ expected = %{<form accept-charset="UTF-8" action="/posts/123" class="formtastic post" data-validate="true" id="edit_post_123" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /></div><li class="string input required stringish" id="post_cost_input"><label class=\" label\" for="post_cost">Cost<abbr title="required">*</abbr></label><input id="post_cost" name="post[cost]" type="text" />\n\n</li></form><script>//<![CDATA[\nwindow.ClientSideValidations.forms['edit_post_123'] = {"type":"Formtastic::FormBuilder","inline_error_class":"inline-errors","validators":{}};\n//]]></script>}
assert_equal expected, output_buffer, "\n\n *** If you're running Ruby 1.8 and this test fails is is most likely due to 1.8's lack of insertion order persistence with Hashes ***\n"
end

0 comments on commit 774fbf9

Please sign in to comment.