Skip to content

Commit

Permalink
specs fro activerecord wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
igrigorik committed Apr 13, 2010
1 parent 970427c commit 522d95f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions spec/activerecord_spec.rb
Expand Up @@ -11,17 +11,19 @@
ActiveRecord::Base.default_timezone = :utc ActiveRecord::Base.default_timezone = :utc
ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger.level = Logger::INFO ActiveRecord::Base.logger.level = Logger::INFO
ActiveRecord::Base.pluralize_table_names = false ActiveRecord::Base.pluralize_table_names = true
ActiveRecord::Base.time_zone_aware_attributes = true ActiveRecord::Base.time_zone_aware_attributes = true
Time.zone = 'UTC' Time.zone = 'UTC'


class Widget < ActiveRecord::Base; end;

describe "ActiveRecord Driver for EM-MySQLPlus" do describe "ActiveRecord Driver for EM-MySQLPlus" do
it "should establish AR connection" do it "should establish AR connection" do
EventMachine.run { EventMachine.run {
Fiber.new { Fiber.new {
ActiveRecord::Base.establish_connection ActiveRecord::Base.establish_connection
result = ActiveRecord::Base.connection.query('select sleep(1)') result = Widget.find_by_sql("select sleep(1)")
p result result.size.should == 1


EventMachine.stop EventMachine.stop
}.resume }.resume
Expand All @@ -35,7 +37,7 @@
3.times do |n| 3.times do |n|
Fiber.new { Fiber.new {
ActiveRecord::Base.establish_connection ActiveRecord::Base.establish_connection
results.push ActiveRecord::Base.connection.query('select sleep(1)') results.push Widget.find_by_sql("select sleep(1)")
}.resume }.resume
end end


Expand All @@ -45,5 +47,4 @@
} }
} }
end end

end
end
1 change: 1 addition & 0 deletions spec/database.yml
@@ -1,4 +1,5 @@
test: test:
adapter: em_mysqlplus adapter: em_mysqlplus
database: widgets database: widgets
user: root
pool: 3 pool: 3

0 comments on commit 522d95f

Please sign in to comment.