Sha256: 2528a0340ae5fbc0ed7675d3125ac5e08a34eb61781999b8ec8fd94c523db6d2
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' describe SchemaMonkey::Middleware::Dumper do let(:migration) { ::ActiveRecord::Migration } before(:each) do migration.create_table "things" do |t| t.integer :column t.index :column end migration.create_table "other" do |t| t.references :thing end migration.add_foreign_key("other", "things") end context TestDumper::Middleware::Dumper::Initial do Then { expect(dump).to match /Schema[.]define.*do\s+#{middleware}/ } end context TestDumper::Middleware::Dumper::Tables do Then { expect(dump).to match /create_table "other".*create_table "#{middleware}".*create_table "things"/m } end context TestDumper::Middleware::Dumper::Table do Then { expect(dump).to match /t[.]integer.*option: #{middleware} \# comment: #{middleware}/ } Then { expect(dump).to match /statement: #{middleware}\s+end\s+(add_index.*)?\s+trailer: #{middleware}/ } end context TestDumper::Middleware::Dumper::Indexes do Then { expect(dump).to match /add_index.*#{middleware}/ } end private def middleware described_class end def dump begin middleware.enable stream = StringIO.new ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream) return stream.string ensure middleware.disable end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
schema_plus_core-0.1.0 | spec/dumper_spec.rb |