Engines issue: rake test_plugins failing when it shouldn't


#1

I create a simple engine with a simple controller:

class FredController < ApplicationController
def hello
render :text => ‘Hello, world!’
end
end

and I create a simple functional test within the engine:

class FredControllerTest < Test::Unit::TestCase

def test_hello
get :hello
assert_response :success
end
end

Running ‘rake test_plugins’ succeeds, and firing up the server and
requesting /fred/hello gives the expected page.

Now, in the project that includes the engine, I override FredController:

class FredController < ApplicationController
def goodbye
render :text => ‘Goodbye.’
end
end

Requesting /fred/hello still gives the correct page (as it should),
but now ‘rake test_plugins’ fails with:

  1. Error:
    test_hello(FredControllerTest):
    ActionController::UnknownAction: No action responded to hello

    ./vendor/plugins/my_engine/test/functional/
    fred_controller_test.rb:16:in `test_hello’

In other words, as soon as I define a controller in the app that is
the same as a controller in the plugin, the engine tests use only the
code from the app and not the code from the plugin. I would have
thought they’d use both (as the running app does), or, at worst, use
only the controller code from the plugin.

Can anyone confirm this issue? Is there some way that I can work
around it?

Cheers,

Pete Y.


#2

This is a known issue, directly a result of an update that I made a
few days ago to the engines plugin. Replace your copy of
/vendor/plugins/engines with what you can find at:

http://opensvn.csie.org/rails_engines/engines/tags/rel_1.0.1

I should have a fixed version later today…

  • james

#3

James,

Thanks for your answer, but I think the problem is more than a few
days old. It’s been happening to my code for a couple of weeks at
least. Replacing the engines plugin with the tagged version suggested
makes no difference.

Cheers,

Pete Y.