Help about speed test in Agile Web Development 2nd

in chapter 13

def test_100_orders
Order.delete_all
LineItem.delete_all

@controller.logger.silence do

  elapsed_time = Benchmark.realtime do
    100.downto(1) do |prd_id|
      cart = Cart.new
      cart.add_product(Product.find(prd_id))
      post :save_order,
           { :order => DAVES_DETAILS },
           { :cart  => cart }
      assert_redirected_to :action => :index
    end
  end
  assert_equal 100, Order.count
  assert elapsed_time < 3.00

end

end

my question is : the test is ok, but after this test, my mysql
depot_test’s
orders table is empty and produtions table has 1000 records.

but in the test:assert_equal 100, Order.count is ok?

why?


Hu Jinpu (nickname: smellcode)
Web developer
email =~ /(^hujinpu)@(gmail).(com)$/
or email.gsub!(/hujinpu/, ‘smellcode’)
http://hujinpu.net

just because self.use_transactional_fixtures = true

rollback

:slight_smile: I resolved this problem by myself.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs