2012-03-12 23:09:21 +00:00
|
|
|
require 'spec_helper'
|
2011-02-13 19:18:34 +00:00
|
|
|
require 'systemu'
|
|
|
|
|
2020-07-20 13:35:41 +00:00
|
|
|
# FIXME: this test might break the others if run before them
|
2013-07-13 01:49:07 +00:00
|
|
|
# started fixing @nbit001
|
|
|
|
describe Impressionist, :migration do
|
2020-07-20 13:35:41 +00:00
|
|
|
fixtures :articles, :impressions, :posts, :profiles
|
|
|
|
it "deletes existing migration and generate the migration file" do
|
2012-03-06 23:35:41 +00:00
|
|
|
pending
|
2020-07-20 16:30:47 +00:00
|
|
|
migrations_dir = Rails.root.join('db/migrate')
|
2011-02-13 19:18:34 +00:00
|
|
|
impressions_migration = Dir.entries(migrations_dir).grep(/impressions/)[0]
|
2020-07-20 13:35:41 +00:00
|
|
|
File.delete("#{migrations_dir}/#{impressions_migration}") if impressions_migration.present?
|
2011-02-13 19:18:34 +00:00
|
|
|
generator_output = systemu("rails g impressionist")[1]
|
|
|
|
migration_name = generator_output.split("migrate/")[1].strip
|
2020-07-20 13:35:41 +00:00
|
|
|
Dir.entries(migrations_dir).include?(migration_name).should be_truthy
|
2011-02-13 19:18:34 +00:00
|
|
|
end
|
2012-03-06 21:42:28 +00:00
|
|
|
|
2020-07-20 13:35:41 +00:00
|
|
|
it "runs the migration created in the previous spec" do
|
2012-03-06 23:35:41 +00:00
|
|
|
pending
|
2011-03-07 04:22:39 +00:00
|
|
|
migrate_output = systemu("rake db:migrate RAILS_ENV=test")
|
2020-07-20 13:35:41 +00:00
|
|
|
migrate_output[1].include?("CreateImpressionsTable: migrated").should be_truthy
|
2011-02-13 19:18:34 +00:00
|
|
|
end
|
2012-03-06 21:42:28 +00:00
|
|
|
end
|