Skip to content
Browse files

use ruby rather than mocha

  • Loading branch information...
1 parent 706d8ea commit 66fe5072fd63b8781cd9adff9fb4d6203dde4a7f @tenderlove tenderlove committed Jan 11, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 activerecord/test/cases/migration_test.rb
View
4 activerecord/test/cases/migration_test.rb
@@ -70,7 +70,9 @@ def test_create_table_with_force_true_does_not_drop_nonexisting_table
# using a copy as we need the drop_table method to
# continue to work for the ensure block of the test
temp_conn = Person.connection.dup
- temp_conn.expects(:drop_table).never
+ temp_conn.extend(Module.new {
@pwnall
pwnall added a note Jan 15, 2012

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ def drop_table; raise "no"; end
+ })
temp_conn.create_table :testings2, :force => true do |t|
t.column :foo, :string
end

1 comment on commit 66fe507

@drogus
Ruby on Rails member
drogus commented on 66fe507 Jan 16, 2012

@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.