Skip to content

Commit

Permalink
fix sqlite specs
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Mar 27, 2016
1 parent 65fe02e commit de25018
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions spec/cases/each_with_ar_sqlite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => ":memory:"
:database => Tempfile.new("db").path
)

class User < ActiveRecord::Base
Expand All @@ -26,14 +26,11 @@ class User < ActiveRecord::Base

3.times { User.create!(:name => "X") }

print "Parent: "
puts User.first.name
puts "Parent: #{User.first.name}"

print "Parallel (#{in_worker_type}): "
Parallel.each([1], in_worker_type => 1) do
puts User.all.map(&:name).join
puts "Parallel (#{in_worker_type}): #{User.all.map(&:name).join}"
end

print "\nParent: "
puts User.first.name
puts "Parent: #{User.first.name}"

4 changes: 2 additions & 2 deletions spec/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ def cpus
end

worker_types.each do |type|
pending "works with SQLite in #{type}" do
`WORKER_TYPE=#{type} ruby spec/cases/each_with_ar_sqlite.rb`.should == "Parent: X\nParallel (in_#{type}): XXX\n\nParent: X\n"
it "works with SQLite in #{type}" do
`WORKER_TYPE=#{type} ruby spec/cases/each_with_ar_sqlite.rb`.should == "Parent: X\nParallel (in_#{type}): XXX\nParent: X\n"
end

it "stops all workers when one fails in #{type}" do
Expand Down

0 comments on commit de25018

Please sign in to comment.