Sha256: ca6ff29ed9c79b7d686ecccbbd3bc7080c07299c99523e0c7e8bf69d6e8fdbf5
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
require 'spec_helper' describe 'Database rake tasks' do let(:app) { Combustion::Application } let(:app_root) { app.root } around do |example| begin FileUtils.rm schema if File.exists? schema example.run ensure FileUtils.rm schema if File.exists? schema end end describe 'db:schema:dump' do let(:schema) { "#{app_root}/db/schema.rb" } it "dumps the schema in 'db/schema.rb'" do Dir.chdir app_root do `rake db:schema:dump` expect(File.exists?(schema)).to be_true end end it 'append the migration schema information if any' do Dir.chdir app_root do `rake db:migrate db:schema:dump` sql = Sequel::Model.db.from( :schema_migrations ).insert_sql(:filename => '1273253849_add_twitter_handle_to_users.rb') expect(File.read(schema)).to include <<-EOS Sequel.migration do change do self << #{sql.inspect} end end EOS end end end describe 'db:structure:dump', :skip_jdbc do let(:schema) { "#{app_root}/db/structure.sql" } it "dumps the schema in 'db/structure.sql'" do Dir.chdir app_root do `rake db:structure:dump` expect(File.exists?(schema)).to be_true end end it 'append the migration schema information if any' do Dir.chdir app_root do `rake db:migrate db:structure:dump` sql = Sequel::Model.db.from( :schema_migrations ).insert_sql(:filename => '1273253849_add_twitter_handle_to_users.rb') expect(File.read(schema)).to include sql end end end end
Version data entries
4 entries across 4 versions & 1 rubygems