[mocha-developer] Mocha and SimplyHelpful

Jonathan Younger daikini at gmail.com
Thu Oct 26 09:54:29 EDT 2006


Hi,

I'm getting a conflict between the Mocha plugin and the Rails  
SimplyHelpful plugin.

For some reason the dom_id method from SimplyHelpful is not being  
found in my views when the Mocha plugin is installed. The dom_id  
method if used in the controller works properly.

This is the error I get when running the tests:

1) Error:
test_truth(HmmControllerTest):
ActionView::TemplateError: undefined method `dom_id' for #<#<Class: 
0x3a529ec>:0x3a529c4>
     On line #2 of app/views/hmm/index.rhtml

     1: <%= @car_dom_id %>
     2: <%= dom_id(@car) %>


Here's my controller:

class HmmController < ApplicationController
   def index
     @car = Car.find(1)
     @car_dom_id = dom_id(@car)
   end
end

Here's my view:

#app/views/hmm/index.rhtml
<%= @car_dom_id %>
<%= dom_id(@car) %>

Here's my test:

require File.dirname(__FILE__) + '/../test_helper'
require 'hmm_controller'

# Re-raise errors caught by the controller.
class HmmController; def rescue_action(e) raise e end; end

class HmmControllerTest < Test::Unit::TestCase
   fixtures :cars

   def setup
     @controller = HmmController.new
     @request    = ActionController::TestRequest.new
     @response   = ActionController::TestResponse.new
   end

   # Replace this with your real tests.
   def test_truth
     get :index
     assert_equal "car_1", assigns(:car_dom_id)
   end
end


This is just an empty rails project running Edge Rails, i.e. rake  
rails:freeze:edge with the Mocha plugin (./script/plugin install  
svn://rubyforge.org/var/svn/mocha/trunk) and SimplyHelpful plugin (./ 
script/plugin install simply_helpful) installed.


Anyone run into this sort of thing before?


Thanks,

Jonathan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20061026/ec56f671/attachment.html 


More information about the mocha-developer mailing list