Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bumping the tests and the rails stub test app in test/rails_root to 2.3.

  • Loading branch information...
commit 26499e24ee42b01dfdfdc7fedae3dbc0bdcb3190 1 parent 0a1274b
@augustl authored
View
2  Rakefile
@@ -8,7 +8,7 @@ task :default => :test
desc 'Test the translated plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
+ t.pattern = 'test/*_test.rb'
t.verbose = true
end
View
2  test/active_record_hooks_test.rb
@@ -1,6 +1,6 @@
require File.join(File.dirname(__FILE__), "test_helper")
-class ActiveRecordHooksTest < Test::Unit::TestCase
+class ActiveRecordHooksTest < ActiveSupport::TestCase
def setup
reset_callbacks Post
end
View
24 test/jquery_validations_controller_output_test.rb
@@ -0,0 +1,24 @@
+class JqueryValidationsControllerOutputTest < ActionController::TestCase
+ def setup
+ @controller = PostsController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+
+ reset_callbacks Post
+ end
+
+ def teardown
+ restore_callbacks Post
+ end
+
+ def test_json_output
+ Post.validates_presence_of :title
+
+ get :new
+ assert_response :success
+
+ assert_select 'script[type=text/javascript]'
+ assert @response.body.include?("$('#new_post').validate")
+ assert @response.body.include?({'rules' => {'post[title]' => {'required' => true}}}.to_json)
+ end
+end
View
17 test/jquery_validations_test.rb
@@ -2,12 +2,8 @@
LiveValidations.use(LiveValidations::Adapters::JqueryValidations)
-class JqueryValidationsTest < Test::Unit::TestCase
+class JqueryValidationsTest < ActiveSupport::TestCase
def setup
- @controller = PostsController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
-
reset_callbacks Post
end
@@ -23,17 +19,6 @@ def test_render_json
assert_equal expected_json_data, validator.json_data
end
- def test_json_output
- Post.validates_presence_of :title
-
- get :new
- assert_response :success
-
- assert_select 'script[type=text/javascript]'
- assert @response.body.include?("$('#new_post').validate")
- assert @response.body.include?({'rules' => {'post[title]' => {'required' => true}}}.to_json)
- end
-
def test_confirmation
Post.validates_confirmation_of :password
assert_expected_json "post[password_confirmation]" => {"equalTo" => "#post_password"}
View
3  test/rails_root/app/controllers/application.rb
@@ -1,3 +0,0 @@
-class ApplicationController < ActionController::Base
- session :session_key => '_live_validations_test_session_id'
-end
View
2  test/rails_root/app/controllers/application_controller.rb
@@ -0,0 +1,2 @@
+class ApplicationController < ActionController::Base
+end
View
4 test/rails_root/config/boot.rb
@@ -67,7 +67,7 @@ def load_rails_gem
class << self
def rubygems_version
- Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
+ Gem::RubyGemsVersion rescue nil
end
def gem_version
@@ -82,7 +82,7 @@ def gem_version
def load_rubygems
require 'rubygems'
- min_version = '1.1.1'
+ min_version = '1.3.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
View
2  test/rails_root/config/environment.rb
@@ -1,7 +1,7 @@
-RAILS_GEM_VERSION = '2.1.1' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
+ config.action_controller.session = {:disabled => true}
config.log_level = :debug
config.cache_classes = false
config.whiny_nils = true
View
15 test/test_helper.rb
@@ -14,20 +14,9 @@
ActiveRecord::Migration.verbose = false
ActiveRecord::Migrator.migrate File.join(rails_root, 'db', 'migrate')
-Test::Unit::TestCase.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
+require 'mocha'
-class Test::Unit::TestCase #:nodoc:
- def create_fixtures(*table_names)
- if block_given?
- Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
- else
- Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
- end
- end
-
- self.use_transactional_fixtures = false
- self.use_instantiated_fixtures = false
-
+class ActiveSupport::TestCase #:nodoc:
def reset_callbacks(model)
@_original_callbacks = {}
View
27 test/validatious_controller_output_test.rb
@@ -0,0 +1,27 @@
+require File.join(File.dirname(__FILE__), "test_helper")
+
+class ValidatiousControllerOutputTest < ActionController::TestCase
+ def setup
+ @controller = PostsController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+
+ reset_callbacks Post
+ end
+
+ def teardown
+ restore_callbacks Post
+ end
+
+ def test_html_attribute_output
+ LiveValidations.use(LiveValidations::Adapters::Validatious)
+ Post.validates_presence_of :title, :category
+
+ get :new
+ assert_response :success
+
+ assert_select('input#post_title.required')
+ assert_select('select#post_category.required')
+ assert css_select('script[type=text/javascript]').empty?
+ end
+end
View
18 test/validatious_test.rb
@@ -1,11 +1,7 @@
require File.join(File.dirname(__FILE__), "test_helper")
-class ValidatiousTest < Test::Unit::TestCase
+class ValidatiousTest < ActiveSupport::TestCase
def setup
- @controller = PostsController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
-
reset_callbacks Post
end
@@ -20,16 +16,4 @@ def test_render_json
expected_json_data = {:title => {:class => "required"}}
assert_equal expected_json_data, validator.tag_attributes_data
end
-
- def test_html_attribute_output
- LiveValidations.use(LiveValidations::Adapters::Validatious)
- Post.validates_presence_of :title, :category
-
- get :new
- assert_response :success
-
- assert_select('input#post_title.required')
- assert_select('select#post_category.required')
- assert css_select('script[type=text/javascript]').empty?
- end
end
Please sign in to comment.
Something went wrong with that request. Please try again.