Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format ar migrate #1182

Merged
merged 2 commits into from Mar 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -149,7 +149,7 @@ def self.down
end
MIGRATION

AR_MODEL_UP_MG = (<<-MIGRATION) unless defined?(AR_MODEL_UP_MG)
AR_MODEL_UP_MG = (<<-MIGRATION).gsub(/^/,' ') unless defined?(AR_MODEL_UP_MG)
create_table :!TABLE! do |t|
!FIELDS!
t.timestamps
Expand Down
24 changes: 12 additions & 12 deletions padrino-gen/test/test_model_generator.rb
Expand Up @@ -82,11 +82,11 @@ def teardown
capture_io { generate(:model, 'person', "name", "age:integer", "email", "-r=#{@apptmp}/sample_project") }
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
assert_match_in_file(/class CreatePeople < ActiveRecord::Migration/m, migration_file_path)
assert_match_in_file(/create_table :people/m, migration_file_path)
assert_match_in_file(/t.string :name/m, migration_file_path)
assert_match_in_file(/t.integer :age/m, migration_file_path)
assert_match_in_file(/t.string :email/m, migration_file_path)
assert_match_in_file(/drop_table :people/m, migration_file_path)
assert_match_in_file(/ create_table :people/m, migration_file_path)
assert_match_in_file(/ t.string :name/m, migration_file_path)
assert_match_in_file(/ t.integer :age/m, migration_file_path)
assert_match_in_file(/ t.string :email/m, migration_file_path)
assert_match_in_file(/ drop_table :people/m, migration_file_path)
end
end

Expand Down Expand Up @@ -116,8 +116,8 @@ def teardown
capture_io { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_users.rb"
assert_match_in_file(/class CreateUsers < ActiveRecord::Migration/m, migration_file_path)
assert_match_in_file(/create_table :users/m, migration_file_path)
assert_match_in_file(/drop_table :users/m, migration_file_path)
assert_match_in_file(/ create_table :users/m, migration_file_path)
assert_match_in_file(/ drop_table :users/m, migration_file_path)
end

should "generate migration file with given fields" do
Expand All @@ -126,11 +126,11 @@ def teardown
capture_io { generate(:model, 'person', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
assert_match_in_file(/class CreatePeople < ActiveRecord::Migration/m, migration_file_path)
assert_match_in_file(/create_table :people/m, migration_file_path)
assert_match_in_file(/t.string :name/m, migration_file_path)
assert_match_in_file(/t.integer :age/m, migration_file_path)
assert_match_in_file(/t.string :email/m, migration_file_path)
assert_match_in_file(/drop_table :people/m, migration_file_path)
assert_match_in_file(/ create_table :people/m, migration_file_path)
assert_match_in_file(/ t.string :name/m, migration_file_path)
assert_match_in_file(/ t.integer :age/m, migration_file_path)
assert_match_in_file(/ t.string :email/m, migration_file_path)
assert_match_in_file(/ drop_table :people/m, migration_file_path)
end
end

Expand Down