Skip to content
This repository
Browse code

Merge remote branch 'rails/master'

  • Loading branch information...
commit 6f929ef801f625854b89eae5b440c04f5d0eef70 2 parents 0d5a060 + 3ba61ec
Xavier Noria fxn authored
2  actionpack/test/controller/resources_test.rb
... ... @@ -1,5 +1,5 @@
1   -require 'active_support/core_ext/object/try'
2 1 require 'abstract_unit'
  2 +require 'active_support/core_ext/object/try'
3 3
4 4 class ResourcesController < ActionController::Base
5 5 def index() render :nothing => true end
3  activerecord/test/cases/attribute_methods_test.rb
@@ -2,6 +2,7 @@
2 2 require 'models/minimalistic'
3 3 require 'models/developer'
4 4 require 'models/auto_id'
  5 +require 'models/boolean'
5 6 require 'models/computer'
6 7 require 'models/topic'
7 8 require 'models/company'
@@ -101,7 +102,7 @@ def test_read_attributes_before_type_cast
101 102
102 103 if current_adapter?(:MysqlAdapter)
103 104 def test_read_attributes_before_type_cast_on_boolean
104   - bool = Booleantest.create({ "value" => false })
  105 + bool = Boolean.create({ "value" => false })
105 106 assert_equal "0", bool.reload.attributes_before_type_cast["value"]
106 107 end
107 108 end
27 activerecord/test/cases/base_test.rb
@@ -10,6 +10,7 @@
10 10 require 'models/project'
11 11 require 'models/default'
12 12 require 'models/auto_id'
  13 +require 'models/boolean'
13 14 require 'models/column_name'
14 15 require 'models/subscriber'
15 16 require 'models/keyboard'
@@ -42,7 +43,7 @@ class ReadonlyTitlePost < Post
42 43 attr_readonly :title
43 44 end
44 45
45   -class Booleantest < ActiveRecord::Base; end
  46 +class Boolean < ActiveRecord::Base; end
46 47
47 48 class BasicsTest < ActiveRecord::TestCase
48 49 fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics, 'warehouse-things', :authors, :categorizations, :categories, :posts
@@ -596,34 +597,34 @@ def test_attributes_on_dummy_time
596 597 end
597 598
598 599 def test_boolean
599   - b_nil = Booleantest.create({ "value" => nil })
  600 + b_nil = Boolean.create({ "value" => nil })
600 601 nil_id = b_nil.id
601   - b_false = Booleantest.create({ "value" => false })
  602 + b_false = Boolean.create({ "value" => false })
602 603 false_id = b_false.id
603   - b_true = Booleantest.create({ "value" => true })
  604 + b_true = Boolean.create({ "value" => true })
604 605 true_id = b_true.id
605 606
606   - b_nil = Booleantest.find(nil_id)
  607 + b_nil = Boolean.find(nil_id)
607 608 assert_nil b_nil.value
608   - b_false = Booleantest.find(false_id)
  609 + b_false = Boolean.find(false_id)
609 610 assert !b_false.value?
610   - b_true = Booleantest.find(true_id)
  611 + b_true = Boolean.find(true_id)
611 612 assert b_true.value?
612 613 end
613 614
614 615 def test_boolean_cast_from_string
615   - b_blank = Booleantest.create({ "value" => "" })
  616 + b_blank = Boolean.create({ "value" => "" })
616 617 blank_id = b_blank.id
617   - b_false = Booleantest.create({ "value" => "0" })
  618 + b_false = Boolean.create({ "value" => "0" })
618 619 false_id = b_false.id
619   - b_true = Booleantest.create({ "value" => "1" })
  620 + b_true = Boolean.create({ "value" => "1" })
620 621 true_id = b_true.id
621 622
622   - b_blank = Booleantest.find(blank_id)
  623 + b_blank = Boolean.find(blank_id)
623 624 assert_nil b_blank.value
624   - b_false = Booleantest.find(false_id)
  625 + b_false = Boolean.find(false_id)
625 626 assert !b_false.value?
626   - b_true = Booleantest.find(true_id)
  627 + b_true = Boolean.find(true_id)
627 628 assert b_true.value?
628 629 end
629 630
2  activerecord/test/models/boolean.rb
... ... @@ -0,0 +1,2 @@
  1 +class Boolean < ActiveRecord::Base
  2 +end
2  activerecord/test/schema/schema.rb
@@ -74,7 +74,7 @@ def create_table(*args, &block)
74 74 t.column :name, :string
75 75 end
76 76
77   - create_table :booleantests, :force => true do |t|
  77 + create_table :booleans, :force => true do |t|
78 78 t.boolean :value
79 79 end
80 80

0 comments on commit 6f929ef

Please sign in to comment.
Something went wrong with that request. Please try again.