'with_kcode' removed.

Testing Sandbox removed.
This commit is contained in:
Arun Agrawal 2011-12-21 15:39:50 +05:30
parent de78c7e8e4
commit 7276fc63be
7 changed files with 18 additions and 58 deletions

View File

@ -1,15 +0,0 @@
module TestingSandbox
# Temporarily replaces KCODE for the block
def with_kcode(kcode)
if RUBY_VERSION < '1.9'
old_kcode, $KCODE = $KCODE, kcode
begin
yield
ensure
$KCODE = old_kcode
end
else
yield
end
end
end

View File

@ -1,9 +1,7 @@
require 'abstract_unit'
require 'testing_sandbox'
class OutputSafetyHelperTest < ActionView::TestCase
tests ActionView::Helpers::OutputSafetyHelper
include TestingSandbox
def setup
@string = "hello"

View File

@ -1,11 +1,9 @@
require 'abstract_unit'
require 'testing_sandbox'
# The exhaustive tests are in test/controller/html/sanitizer_test.rb.
# This tests the that the helpers hook up correctly to the sanitizer classes.
class SanitizeHelperTest < ActionView::TestCase
tests ActionView::Helpers::SanitizeHelper
include TestingSandbox
def test_strip_links
assert_equal "Dont touch me", strip_links("Dont touch me")

View File

@ -1,10 +1,8 @@
# encoding: utf-8
require 'abstract_unit'
require 'testing_sandbox'
class TextHelperTest < ActionView::TestCase
tests ActionView::Helpers::TextHelper
include TestingSandbox
def setup
super

View File

@ -56,18 +56,5 @@ module ActiveRecord
ensure
ActiveRecord::SQLCounter.ignored_sql = prev_ignored_sql
end
def with_kcode(kcode)
if RUBY_VERSION < '1.9'
orig_kcode, $KCODE = $KCODE, kcode
begin
yield
ensure
$KCODE = orig_kcode
end
else
yield
end
end
end
end

View File

@ -91,7 +91,6 @@ class AssociationValidationTest < ActiveRecord::TestCase
end
def test_validates_size_of_association_utf8
with_kcode('UTF8') do
assert_nothing_raised { Owner.validates_size_of :pets, :minimum => 1 }
o = Owner.new('name' => 'あいうえおかきくけこ')
assert !o.save
@ -99,7 +98,6 @@ class AssociationValidationTest < ActiveRecord::TestCase
o.pets.build('name' => 'あいうえおかきくけこ')
assert o.valid?
end
end
def test_validates_presence_of_belongs_to_association__parent_is_new_record
repair_validations(Interest) do

View File

@ -149,7 +149,6 @@ class UniquenessValidationTest < ActiveRecord::TestCase
assert t2.valid?, "should validate with nil"
assert t2.save, "should save with nil"
with_kcode('UTF8') do
t_utf8 = Topic.new("title" => "Я тоже уникальный!")
assert t_utf8.save, "Should save t_utf8 as unique"
@ -160,7 +159,6 @@ class UniquenessValidationTest < ActiveRecord::TestCase
assert !t2_utf8.save, "Shouldn't save t2_utf8 as unique"
end
end
end
def test_validate_case_sensitive_uniqueness_with_special_sql_like_chars
Topic.validates_uniqueness_of(:title, :case_sensitive => true)
@ -256,14 +254,12 @@ class UniquenessValidationTest < ActiveRecord::TestCase
end
def test_validate_uniqueness_with_limit_and_utf8
with_kcode('UTF8') do
# Event.title is limited to 5 characters
e1 = Event.create(:title => "一二三四五")
assert e1.valid?, "Could not create an event with a unique, 5 character title"
e2 = Event.create(:title => "一二三四五六七八")
assert !e2.valid?, "Created an event whose title, with limit taken into account, is not unique"
end
end
def test_validate_straight_inheritance_uniqueness
w1 = IneptWizard.create(:name => "Rincewind", :city => "Ankh-Morpork")