Permalink
Browse files

added log

  • Loading branch information...
1 parent 5cf53a1 commit 2509e0bede06dc42162be5e73149a2ab81839027 @nakajima committed Nov 12, 2008
Showing with 15 additions and 2 deletions.
  1. +8 −2 lib/acts_as_fu/helper.rb
  2. +7 −0 spec/acts_as_fu_spec.rb
View
10 lib/acts_as_fu/helper.rb
@@ -1,6 +1,12 @@
module ActsAsFu
- def self.connect!(config={})
- ActiveRecord::Base.establish_connection(config)
+ class << self
+ attr_reader :log
+
+ def connect!(config={})
+ @log = ""
+ ActiveRecord::Base.logger = Logger.new(StringIO.new(log))
+ ActiveRecord::Base.establish_connection(config)
+ end
end
def build_model(name, options={}, &block)
View
7 spec/acts_as_fu_spec.rb
@@ -113,4 +113,11 @@ class << Foo; attr_reader :bar end
system("rm #{db}")
end
end
+
+ describe "ActsAsFu.report!" do
+ it "has a log" do
+ build_foos
+ ActsAsFu.log.should include("CREATE TABLE")
+ end
+ end
end

0 comments on commit 2509e0b

Please sign in to comment.