aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-24 21:57:42 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-24 22:00:40 +0100
commitbea3524e3f5a56e4dc87ae240a2c58301e73a128 (patch)
tree112ef9a1e8fb4d220084af9d60ec98925c23ae77
parenta410a9c8f7197bc321e1adde46fa98af8a2176ad (diff)
downloadrails-bea3524e3f5a56e4dc87ae240a2c58301e73a128.tar.gz
rails-bea3524e3f5a56e4dc87ae240a2c58301e73a128.tar.bz2
rails-bea3524e3f5a56e4dc87ae240a2c58301e73a128.zip
Last attempt to fix 1.8.7 tests.
-rw-r--r--railties/lib/rails/generators/generated_attribute.rb2
-rw-r--r--railties/test/generators/migration_generator_test.rb13
-rw-r--r--railties/test/generators/model_generator_test.rb8
3 files changed, 15 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb
index 964bd6280c..cfd58527ef 100644
--- a/railties/lib/rails/generators/generated_attribute.rb
+++ b/railties/lib/rails/generators/generated_attribute.rb
@@ -96,7 +96,7 @@ module Rails
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
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb
index d81fc59fbf..8f352d1ea6 100644
--- a/railties/test/generators/migration_generator_test.rb
+++ b/railties/test/generators/migration_generator_test.rb
@@ -109,10 +109,15 @@ class MigrationGeneratorTest < Rails::Generators::TestCase
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)
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index ffb3d2ceba..68c1015cbc 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -171,9 +171,11 @@ class ModelGeneratorTest < Rails::Generators::TestCase
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)