Skip to content

Commit

Permalink
added spec for verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
mwise committed Aug 1, 2014
1 parent f9fac76 commit 0873198
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions spec/lib/mysql_online_migrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down

0 comments on commit 0873198

Please sign in to comment.