Permalink
Browse files

Fix for Ruby 1.8.7

Fix for output buffer
Removed javscript test
  • Loading branch information...
1 parent edfdff7 commit 78e2b9119e8b89d80e2020ce7e37f26fe14afdd9 @bcardarella committed Jun 10, 2011
View
@@ -6,7 +6,7 @@ multitask :default => 'test:ruby'
require 'rake/testtask'
namespace :test do
desc %(Run all tests)
- multitask :all => ['test:all_rubies', 'test:js']
+ multitask :all => ['test:all_rubies']
desc %(Test Ruby code)
Rake::TestTask.new(:ruby) do |test|
@@ -16,6 +16,6 @@ namespace :test do
end
task :all_rubies do
- system "rvm ruby-1.8.7@client_side_validations,ruby-1.9.2@client_side_validations rake test:ruby"
+ system "rvm ruby-1.8.7@client_side_validations-rails_2,ruby-1.9.2@client_side_validations-rails_2 rake test:ruby"
end
end
@@ -0,0 +1,4 @@
+module ClientSideValidations::Rails2; end
+
+require 'client_side_validations/rails_2/action_view'
+require 'client_side_validations/rails_2/active_record'
@@ -1 +1,7 @@
+module ClientSideValidations::Rails2::ActionView; end
+
require 'client_side_validations/action_view'
+require 'client_side_validations/rails_2/action_view/form_helper'
+
+ActionView::Base.send(:include, ClientSideValidations::Rails2::ActionView::Helpers::FormHelper)
+
@@ -1,5 +1,11 @@
module ClientSideValidations::Rails2::ActionView::Helpers
module FormHelper
-
+ def form_for(record_or_name_or_array, *args, &proc)
+ html = super
+ if match = html.match(/<script.+$/)
+ concat(match[0])
+ end
+ end
end
end
+
@@ -44,6 +44,8 @@ module ClassMethods
require 'client_side_validations/rails_2/active_record/active_model/validations/numericality'
module ActiveModel::Validations::ClassMethods
- alias_method :validates_size_of, :validates_length_of
+ def validates_size_of(*attr_names)
+ validates_length_of(*attr_names)
+ end
end
@@ -8,10 +8,7 @@
module ActionViewTestSetup
include ::ClientSideValidations::ActionView::Helpers::FormHelper
include ::ClientSideValidations::ActionView::Helpers::FormTagHelper
-
- def form_for(*)
- @output_buffer = super
- end
+ include ::ClientSideValidations::Rails2::ActionView::Helpers::FormHelper
def setup
super

0 comments on commit 78e2b91

Please sign in to comment.