apotonick/cells — Issue #88: Unable to verify instance variables for last render_cell call with parameters
Author: hpathan
Created: 2011-11-08 15:19:44+00:00
State: open

I am using Cells on rails2.3/ruby1.8.7. I tried following test case and it fails saying wrong number of arguments

should "return the instance variables from the last #render_cell" do
BassistCell.class_eval do
def sleep(options)
@duration = options[:duration]
end
end
render_cell(:bassist, :sleep, "8h")
assert_equal({:duration => "8h"}, view_assigns)
end

Stacktrace:

ArgumentError: wrong number of arguments (2 for 1)
.../test_case.rb:83:in `render_state'
.../test_case.rb:83:in `render_cell'
.../test_case.rb:93:in `extract_state_ivars_for'
.../test_case.rb:82:in `render_cell'

This is because render_state takes args as second parameter in test_case.rb but base.rb does not have it. It works for cells which does not have parameters because of *args but fails if there is any.

Examples like asserting on posts for given author name could use this test case, where entire HTML need not be tested.