Skip to content
This repository
Browse code

use ruby rather than mocha

  • Loading branch information...
commit 66fe5072fd63b8781cd9adff9fb4d6203dde4a7f 1 parent 706d8ea
Aaron Patterson tenderlove authored

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. +3 1 activerecord/test/cases/migration_test.rb
4 activerecord/test/cases/migration_test.rb
@@ -70,7 +70,9 @@ def test_create_table_with_force_true_does_not_drop_nonexisting_table
70 70 # using a copy as we need the drop_table method to
71 71 # continue to work for the ensure block of the test
72 72 temp_conn = Person.connection.dup
73   - temp_conn.expects(:drop_table).never
  73 + temp_conn.extend(Module.new {
  74 + def drop_table; raise "no"; end
  75 + })
74 76 temp_conn.create_table :testings2, :force => true do |t|
75 77 t.column :foo, :string
76 78 end

1 comment on commit 66fe507

Victor Costan

Off the top of my head, I'd have written

class <<temp_conn
  def drop_table; raise "no"; end
end

Could you please comment on why is it better to use extend and an anonymous module? Thanks!

Piotr Sarnacki
Collaborator

@tenderlove what's the rationale behind such changes? mocha expectation reads better imho.

Please sign in to comment.
Something went wrong with that request. Please try again.