Permalink
Browse files

Last attempt to fix 1.8.7 tests.

  • Loading branch information...
1 parent a410a9c commit bea3524e3f5a56e4dc87ae240a2c58301e73a128 @josevalim josevalim committed Dec 24, 2011
@@ -96,7 +96,7 @@ def has_uniq_index?
end
def inject_options
- @attr_options.blank? ? '' : ", #{@attr_options.to_s.gsub(/[{}]/, '')}"
+ "".tap { |s| @attr_options.each { |k,v| s << ", :#{k} => #{v.inspect}" } }
end
def inject_index_options
@@ -109,10 +109,15 @@ def test_add_migration_with_attributes_index_declaration_and_attribute_options
assert_migration "db/migrate/#{migration}.rb" do |content|
assert_method :change, content do |up|
- assert_match(/add_column :books, :title, :string, :limit=>40/, up)
- assert_match(/add_column :books, :content, :string, :limit=>255/, up)
- assert_match(/add_column :books, :price, :decimal, :precision=>5, :scale=>2/, up)
- assert_match(/add_column :books, :discount, :decimal, :precision=>3, :scale=>2/, up)
+ assert_match(/add_column :books, :title, :string, :limit => 40/, up)
+ assert_match(/add_column :books, :content, :string, :limit => 255/, up)
+ assert_match(/add_column :books, :price, :decimal, :precision => 5, :scale => 2/, up)
+ assert_match(/add_column :books, :price, :decimal,/, up)
+ assert_match(/, :precision => 5/, up)
+ assert_match(/, :scale => 2/, up)
+ assert_match(/add_column :books, :discount, :decimal,/, up)
+ assert_match(/, :precision => 3/, up)
+ assert_match(/, :scale => 2/, up)
end
assert_match(/add_index :books, :title/, content)
assert_match(/add_index :books, :price/, content)
@@ -171,9 +171,11 @@ def test_add_migration_with_attributes_index_declaration_and_attribute_options
assert_migration "db/migrate/create_products.rb" do |content|
assert_method :change, content do |up|
assert_match(/create_table :products/, up)
- assert_match(/t.string :title, :limit=>40/, up)
- assert_match(/t.string :content, :limit=>255/, up)
- assert_match(/t.decimal :price, :precision=>5, :scale=>2/, up)
+ assert_match(/t.string :title, :limit => 40/, up)
+ assert_match(/t.string :content, :limit => 255/, up)
+ assert_match(/t.decimal :price,/, up)
+ assert_match(/, :precision => 5/, up)
+ assert_match(/, :scale => 2/, up)
end
assert_match(/add_index :products, :title/, content)
assert_match(/add_index :products, :price/, content)

0 comments on commit bea3524

Please sign in to comment.