Permalink
Browse files

Both tests are using the same model, move the model to another file a…

…nd add the missing require
  • Loading branch information...
1 parent 677564f commit ecf59b4776ab4508689f9d6166f1419b9f554f2c @spastorino spastorino committed Aug 14, 2010
@@ -2,6 +2,7 @@
require 'models/minimalistic'
require 'models/developer'
require 'models/auto_id'
+require 'models/boolean'
require 'models/computer'
require 'models/topic'
require 'models/company'
@@ -101,7 +102,7 @@ def test_read_attributes_before_type_cast
if current_adapter?(:MysqlAdapter)
def test_read_attributes_before_type_cast_on_boolean
- bool = Booleantest.create({ "value" => false })
+ bool = Boolean.create({ "value" => false })
assert_equal "0", bool.reload.attributes_before_type_cast["value"]
end
end
@@ -10,6 +10,7 @@
require 'models/project'
require 'models/default'
require 'models/auto_id'
+require 'models/boolean'
require 'models/column_name'
require 'models/subscriber'
require 'models/keyboard'
@@ -42,7 +43,7 @@ class ReadonlyTitlePost < Post
attr_readonly :title
end
-class Booleantest < ActiveRecord::Base; end
+class Boolean < ActiveRecord::Base; end
class BasicsTest < ActiveRecord::TestCase
fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics, 'warehouse-things', :authors, :categorizations, :categories, :posts
@@ -854,34 +855,34 @@ def test_attributes_on_dummy_time
end
def test_boolean
- b_nil = Booleantest.create({ "value" => nil })
+ b_nil = Boolean.create({ "value" => nil })
nil_id = b_nil.id
- b_false = Booleantest.create({ "value" => false })
+ b_false = Boolean.create({ "value" => false })
false_id = b_false.id
- b_true = Booleantest.create({ "value" => true })
+ b_true = Boolean.create({ "value" => true })
true_id = b_true.id
- b_nil = Booleantest.find(nil_id)
+ b_nil = Boolean.find(nil_id)
assert_nil b_nil.value
- b_false = Booleantest.find(false_id)
+ b_false = Boolean.find(false_id)
assert !b_false.value?
- b_true = Booleantest.find(true_id)
+ b_true = Boolean.find(true_id)
assert b_true.value?
end
def test_boolean_cast_from_string
- b_blank = Booleantest.create({ "value" => "" })
+ b_blank = Boolean.create({ "value" => "" })
blank_id = b_blank.id
- b_false = Booleantest.create({ "value" => "0" })
+ b_false = Boolean.create({ "value" => "0" })
false_id = b_false.id
- b_true = Booleantest.create({ "value" => "1" })
+ b_true = Boolean.create({ "value" => "1" })
true_id = b_true.id
- b_blank = Booleantest.find(blank_id)
+ b_blank = Boolean.find(blank_id)
assert_nil b_blank.value
- b_false = Booleantest.find(false_id)
+ b_false = Boolean.find(false_id)
assert !b_false.value?
- b_true = Booleantest.find(true_id)
+ b_true = Boolean.find(true_id)
assert b_true.value?
end
@@ -74,7 +74,7 @@ def create_table(*args, &block)
t.column :name, :string
end
- create_table :booleantests, :force => true do |t|
+ create_table :booleans, :force => true do |t|
t.boolean :value
end

0 comments on commit ecf59b4

Please sign in to comment.