[rspec-users] Trivial controller spec fail

rodrigo benenson rodrigo.benenson at gmail.com
Fri Mar 26 18:42:32 EDT 2010


After hours searching the source of the problem I finally got it: RubyAmf

http://code.google.com/p/rubyamf/issues/detail?id=85

this problem was already encountered in 2007
http://www.mail-archive.com/rspec-users@rubyforge.org/msg02556.html

three years later I had the same problem (using the latest version of
rubyamf and everything else).

I'm discovering that ruby's "super flexibility" can generate some very
nasty "across borders" effects.

I hope this email will help future rspec + rubyamf users.

Regards,
rodrigob.

On Thu, Mar 25, 2010 at 5:01 PM, rodrigo benenson
<rodrigo.benenson at gmail.com> wrote:
>> If you're rendering another action in Rails, this should read:
>>  render :action => "teaser_v1"
>
> I changed the teaser_controller.rb as mentioned. It makes no
> difference, I get the exact same error.
> Please notice that, as mentioned, the application does run correctly.
> I already tried it manually,  the page does render as expected. Ruby
> on Rails is happy with the code.
>
> Thanks for the trial anyway.
>
> The problem seems to be strictly related to the rspec testing
> environment/method.
>
> Anyone got another idea ? Another test I could do to figure this out ?
>
> Regards,
> rodrigob.
>
> On Thu, Mar 25, 2010 at 12:08 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
>> On Thu, Mar 25, 2010 at 5:11 AM, rodrigo benenson
>> <rodrigo.benenson at gmail.com> wrote:
>>> Hello RSpec community !
>>
>> Welcome, Rodrigo.
>>
>>> I'm a Ruby on Rails newby trying to get my first application running.
>>> I already got some of the website running and now I'm writting the
>>> tests to verify that everything works as expected and that it will
>>> stay like that in future versions.
>>> However I'm having a really hard time getting RSpec to run correctly.
>>>
>>> Following the mailing list policy I have created a gist with:
>>>
>>> system configuration.txt -> my gem list and spec version
>>> teaser_controller.rb -> the 12 lines dummy controller
>>> teaser_controller_spec.rb -> the 14 lines spec that fails
>>> output.txt -> the error I get when I run "rake spec:controllers", with
>>> its traceback
>>>
>>> http://gist.github.com/343339
>>>
>>> My controller does
>>>  def index
>>>        render :teaser_v1
>>
>> If you're rendering another action in Rails, this should read:
>>
>>  render :action => "teaser_v1"
>>
>> Take a look at http://api.rubyonrails.org/classes/ActionController/Base.html#M000658
>> for more info.
>>
>> HTH,
>> David
>>
>>
>>>  end
>>>
>>> def teaser_v1
>>>  end
>>>
>>> My spec does
>>>  it "renders :teaser_v1" do
>>>      get :index
>>>  end
>>>
>>> and then rake spec does
>>> ArgumentError in 'TeaserController GET index renders :teaser_v1'
>>> wrong number of arguments (2 for 1)
>>> /home/rodrigob/work/popster_work/popster_bzr/src/web/popster/app/controllers/teaser_controller.rb:6:in
>>> `index'
>>> /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in
>>> `send'
>>>
>>> The teaser_controller just renders a static html files, no templates,
>>> no partials, no nothing. Yet, the test fails.
>>>
>>> I have created a side test project where I ran
>>> ruby script/generate rspec_scaffold Stuff name:string category:name
>>>
>>> and compared the created files with mines. But I still cannot see why
>>> the test project specs pass, and mines do not.
>>>
>>> Your help is very welcome.
>>> Than you very much for creating such a nice specification tool.
>>> I hope I will be able to use and contribute to it in the future.
>>>
>>> Regards,
>>> rodrigob.
>>> _______________________________________________
>>> rspec-users mailing list
>>> rspec-users at rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/rspec-users
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>


More information about the rspec-users mailing list