Hello guys,
I’ve got a completely unexpected behaviour in my specs, if a protected
method is called under any controller spec, JRuby throws an error like
this one:
NameError in ‘SampleController on index calls Should call the
protected method `protected_method’ called for
#SampleController:0x238067
But under MRI it just works
Here’s the controller:
class SampleController < ApplicationController
def index
protected_method
end
protected
def protected_method
@protected = ‘This is the protected string’
end
end
And here’s the spec:
require File.dirname(FILE) + ‘/…/spec_helper’
describe SampleController do
describe ‘on index calls’ do
def do_get
get :index
end
it 'Should call the protected method' do
controller.should_receive :protected_method
do_get
end
it 'Should assign the @protected variable' do
do_get
assigns[:protected].should_not be_blank
end
end
end
Any ideas about what’s happening ()
–
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
João Pessoa, PB, +55 83 8867-7208
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email