Problem with gettext and functional tests

Hi,

I am using gettext to let my web application know several languages. All
works fine, but since I integrated it, my functional tests don’t work
any
more.
I keep getting the error message:
NoMethodError: undefined method `cgi’ for
#ActionController::TestRequest:0xb77f7f88.

All right, TestRequest doesn’t have a cgi method. Therefore I just
included
this into test_helper.rb:
ActionController::TestRequest.send(:include, CGI::QueryExtension).

Now the error message changes to:
NameError: undefined local variable or method `env_table’ for
#ActionController::TestRequest:0xb7785848.

Great, but then there isn’t a module left (the cgi class is the only
construct, which implements it), which I could use to include env_table;
and
I really don’t want to start cgi hacking…

How should I solve this problem?
Any help is greatly appreciated.

Markus

P.S.: Is this normal behaviour that the TestRequest class isn’t cgi
capable?

Hi,

What version of Ruby-GetText you use?
1.6.0 ?

I’ve fixed similer problem once. But if you
use 1.6.0, there has been another problem yet.

And also tell me your environment detail.

show me the result of “ruby script/about”.

On Thu, 6 Jul 2006 15:44:10 +0200

Hi,

first of all thank you for your response.
@Chuck: Since I am using rails 1.0, integration tests will all go fine,
because there are none in rails 1.0 ;-).

@Masao: I was using ruby-gettext 1.0, but after your email I tried all
kinds
of versions. All result to the same error. What’s a good and stable
version
of gettext anyway?

Here is the output of ruby script/about:
About your application’s environment
Ruby version 1.8.4 (i486-linux)
RubyGems version 0.8.11
Rails version 1.0.0
Active Record version 1.13.2
Action Pack version 1.11.2
Action Web Service version 1.0.0
Action Mailer version 1.1.5
Active Support version 1.2.5
Application root /home/markus/workspace/jobs
Environment development
Database adapter mysql

Any ideas left?
I really appreciate your help, I am already getting somewhat desperate
:slight_smile: .

Markus

Hi,
just to complete this.
I finally found a solution, which even seems a bit silly; but hey it
works
:-).

I just had to include the following to test_helper.rb:

class ActionController::TestRequest; def cgi() end; end

Thanks again for helping,
Markus

On 7/6/06, Masao M. [email protected] wrote:

NoMethodError: undefined method `cgi’ for
Great, but then there isn’t a module left (the cgi class is the only
construct, which implements it), which I could use to include env_table; and
I really don’t want to start cgi hacking…

How should I solve this problem?
Any help is greatly appreciated.

Markus

P.S.: Is this normal behaviour that the TestRequest class isn’t cgi capable?

Do you have the same problems with Integration tests? Functional and
Integration tests share mostly the same structure so it would be easy
to test but I find that there are things in the functional tests that
are missing that are present in the Integration tests.

Cheers,
Chuck V.

Hi,

On Thu, 13 Jul 2006 17:52:28 +0200
“Markus Piff” [email protected] wrote:

Hi,
just to complete this.
I finally found a solution, which even seems a bit silly; but hey it works
:-).

I just had to include the following to test_helper.rb:

class ActionController::TestRequest; def cgi() end; end

Hmm. Strange.
There is the same code in gettext/rails.rb (Since 1.5.0) .
Did you “require ‘gettext/rails’” anywhere ?

Hi!

In rgettext 1.0 there is no such code.
And as I already told you before, I tried all kinds of rgettext versions
(all installed with gem) but all resulted to the same error.
Of course I had a require “gettext/rails” included; otherwise other
errors
would have shown up.

Anyways the thing works now :slight_smile:
Markus