How do I run the Rails test suite on Edge?

I want to submit a patch for Rails.

I have checked out from the trunk.

I have created what I assume is the test database based on contents of
activerecord/test/fixtures

QUESTIONS:

  1. I’m not sure how to actually attempt to run the tests. Where do I
    configure the DB connection to point to my test database?

  2. How do I actually run the tests?

Thanks,
Wes

More specifically, I want to run the ActiveRecord test suite.

On 9/8/06, ã?¹ã?¿ã?³ ã??ã?ºã?¬ã??ã?¯ [email protected] wrote:

:buffer_size => ‘4096’ )
end

Any ideas, suggestion, quirk-remover-spray ? (I’m desperate…)

Hi Stan - Rails sets the HTTP header Cache-Control: no-cache by default.
IE
cries big tears when you download a no-cache file over SSL since,
internally, it can’t save the file to the disk cache! Reference
Internet Explorer file downloads over SSL do not work with the cache control headers - Microsoft Support and
http://support.microsoft.com/kb/815313

Please try headers.delete(‘Cache-Control’) before the call to send_data.
Also see the expires_at and expires_now for a Railsy take on HTTP
caching.

Best,
jeremy

Hi and thanks if you can help…

I have a quirk in my application : i can’t make send_data to stream for
download (disposition=attachment) an image over SSL with internet
explorer.
Works fine with FF (ssl or not), works fine inline (ssl or not, IE or
FF), works even fine without ssl (still IE).
But when i try to get the link through SSL, IE somehow gives me a :

“cannot download blabla from someurl, not able to open this internet
site, requested site either unavailable or cannot be found. please try
again later…”

Of course it doesn’t work later. The only thing i could find about this
is from the rails api on send_file : “IE versions 4, 5, 5.5, and 6 are
all known to have a variety of quirks (especially when downloading over
SSL)”

see my source below. I’m using lighttpd with fcgi, nothing fancy.

def download
qr = blabla (edit)
send_data(qr.to_blob, :filename => qr.code+’.png’, :type =>
‘image/x-png’, :disposition => ‘attachment’, :streaming => ‘true’,
:buffer_size => ‘4096’ )
end

Any ideas, suggestion, quirk-remover-spray ? (I’m desperate…)

Stan

Wes G. wrote:

configure the DB connection to point to my test database?
If you go into the activerecord directory, there’s a file called
RUNNING_UNIT_TESTS. In there, it says:

== Creating the test database

The default names for the test databases are “activerecord_unittest”
and
“activerecord_unittest2”. If you want to use another database name then
be sure
to update the connection adapter setups you want to test with in
test/connections//connection.rb.
When you have the database online, you can import the fixture tables
with
the test/fixtures/db_definitions/*.sql files.

Assuming you’re running MySQL, this means that you have to create two
new databases called ‘activerecord_unittest’ and
‘activerecord_unittest2’. Then, import the starting structure/data in
from the provided SQL files using commands like:

mysql -u root -p activerecord_unittest <
test/fixtures/db_definitions/mysql.sql
mysql -u root -p activerecord_unittest2 <
test/fixtures/db_definitions/mysql2.sql

If you look in the connections.rb file in
test/connections/native_mysql/connection.rb, you’ll see that it is set
up by default to use a user ‘rails’ with no password. So make a user
‘rails’ with no password and grant it permissions on the two new
databases.

  1. How do I actually run the tests?

Again, in RUNNING_UNIT_TESTS, it says:

The easiest way to run the unit tests is through Rake. The default task
runs
the entire test suite for all the adapters. You can also run the suite
on just
one adapter by using the tasks test_mysql_ruby, test_ruby_mysql,
test_sqlite,
or test_postgresql. For more information, checkout the full array of
rake tasks with “rake -T”

So to run the tests using the MySQL adapter, just run

rake test_mysql

Hope that helps.

Chris

Thanks ! Works great ! Had to delete the pragma as well.

I have another issue with IE on this actually, it doesn’t look like
caring much about my type=>‘image/x-png’ : I get Type: Unkown File Type.

I’ve been careful to check that this one was on the list of known mime
types
(http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/overview/appendix_a.asp),
and I know from that article that IE checks the 256 first bytes to
ensure the type matches the data.

Is there a problem with my image (built within rmagick) or is it related
to headers and cache once again ? (first fix didn’t do much for that
other problem).

here is my to_blob :

def to_blob(fileformat=‘PNG’)
draw()
return @imgl.to_blob do
self.format = fileformat
end
end

Stan

Chris,

Thanks! I look forward to doing it later today.

Wes