Permalink
Browse files

Fixed defined constants interacting in nested contexts

  • Loading branch information...
1 parent da96a87 commit 3adfa2c8bb5bd2e9bcf6ad8b5407100800ccdec3 @jferris jferris committed Jul 5, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 spec/spec_helper.rb
View
@@ -31,21 +31,23 @@ module DefinesConstants
def self.included(example_group)
example_group.class_eval do
before do
- @defined_constants = []
- @created_tables = []
+ @defined_constants ||= []
+ @created_tables ||= []
end
after do
@defined_constants.reverse.each do |path|
namespace, class_name = *constant_path(path)
namespace.send(:remove_const, class_name)
end
+ @defined_constants.clear
@created_tables.each do |table_name|
ActiveRecord::Base.
connection.
execute("DROP TABLE IF EXISTS #{table_name}")
end
+ @created_tables.clear
end
def define_class(path, base = Object, &block)

0 comments on commit 3adfa2c

Please sign in to comment.