Behavior Change in Scripts since 1.1?


#1

Occasionally we need to run scripts (such as from cron) that have access
to the rails environment.

Since we’ve upgraded to 1.1 (I believe it coincides with that), all of
our scripts seem to run as unit tests.

An example (obviously useless), which would be store in the script
directory:

------BEGIN CODE----------------------------
RAILS_ENV = ‘development’
require File.dirname(FILE) + ‘/…/config/environment’

score = Score.find(:first)

print "Score is: " + score.score.to_s + “\n”
------END CODE------------------------------

Outputs:
------BEGIN OUTPUT----------------------------
Score is: 183945
Loaded suite script/superlatives
Started

Finished in 0.00114 seconds.

0 tests, 0 assertions, 0 failures, 0 errors
------END OUTPUT------------------------------

Why is the benchmarking/unit test related output coming up?


#2

On May 25, 2006, at 11:53 AM, Sean Hermany wrote:

------BEGIN CODE----------------------------
Score is: 183945

Posted via http://www.ruby-forum.com/.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Sean-

Thats a very good question. I have just been noticing this myself.

Except for me it happens when I run something with script/console.
Even if I just try to run script/console ‘Post.find :all’ It ouputs
the same test unit output you show above. I haven’t been able to
figure out why yet. I’ll let you know if I do.

-Ezra


#3

On May 25, 2006, at 11:53 AM, Sean Hermany wrote:

------BEGIN CODE----------------------------
Score is: 183945

Posted via http://www.ruby-forum.com/.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Sean-

I actually just figured out that the file_column plugin was making

this happen. For some reason just having the file_column plugin in
vendor/plugins was making the test unit output happen. I moved the
file_column dir out of the project temporarily and the problem went
away. So are you running file_columnn? :wink:

-Ezra


#4

The only plugin I’m using for this particular project is
tzinfo_timezone, which I highly doubt would be causing this behavior
(but then, I don’t know what’s causing this behavior, so who am I to
say).

Ezra Z. wrote:

Sean-

I actually just figured out that the file_column plugin was making
this happen. For some reason just having the file_column plugin in
vendor/plugins was making the test unit output happen. I moved the
file_column dir out of the project temporarily and the problem went
away. So are you running file_columnn? :wink:

-Ezra