diff --git a/spec/lib/mysql_online_migrations_spec.rb b/spec/lib/mysql_online_migrations_spec.rb index 3c9a31d..f64c823 100644 --- a/spec/lib/mysql_online_migrations_spec.rb +++ b/spec/lib/mysql_online_migrations_spec.rb @@ -10,10 +10,12 @@ end context "#connection" do - shared_examples_for "Mysql2AdapterWithoutLock created" do + shared_examples_for "Mysql2AdapterWithoutLock created" do |verbose| it "memoizes an instance of Mysql2AdapterWithoutLock" do + MysqlOnlineMigrations.verbose = verbose + ActiveRecord::ConnectionAdapters::Mysql2AdapterWithoutLock.should_receive(:new) - .with(an_instance_of(ActiveRecord::ConnectionAdapters::Mysql2Adapter), nil).once.and_call_original + .with(an_instance_of(ActiveRecord::ConnectionAdapters::Mysql2Adapter), verbose).once.and_call_original 3.times { migration.connection } end end @@ -26,6 +28,10 @@ it_behaves_like "Mysql2AdapterWithoutLock created" end + context 'when migrating with verbose output' do + it_behaves_like "Mysql2AdapterWithoutLock created", true + end + context 'when rolling back' do before do migration.instance_variable_set(:@connection, ActiveRecord::Migration::CommandRecorder.new(ActiveRecord::Base.connection))