How to improve this spec

Hi guys. One of my specs is very weak, and I’d really like to improve
it.

Lines 111-116 are what I’m having trouble speccing, and depend on
lines 105-109.

105 # Grab all of the properties, filtering using the given
conditions.
106 @properties = Property.find :all, :conditions => [
107 processed_conditions[:conditions_string],
108 processed_conditions[:conditions_hash]
109 ]
110
111 # Generate a table of properties to list.
112 @property_data = render_to_string(
113 :partial => ‘properties/map_properties_table’,
114 :collection => @properties,
115 :locals => {:index_of_last_row => @properties.size}
116 )
117
118 @number_of_properties_found_sentence =
render_to_string :partial => ‘properties/number_of_properties_found’

My spec for lines 104-108 are fine. Below is what I have for 111-16,
which I’d like to improve:

498 it “should render the ‘map_properties_table’ partial” do
499 pending
500
controller.should_receive(:render_to_string).with(any_args()).twice
501 do_xhr @params
502 end

Specifically, I’d like to improve what’s passed to #with . However, my
specs don’t have the variable “@properties”, so I’m not sure how to go
about this. Any suggestions? I’m all ears!

Thanks,
Nick

On Sat, Oct 11, 2008 at 2:19 PM, Nick H. [email protected]
wrote:

109 ]

Specifically, I’d like to improve what’s passed to #with . However, my
specs don’t have the variable “@properties

If you mocked the Property.find call, you’d have @properties.

///ark

On 2008-10-11, at 17:31, Mark W. wrote:

If you mocked the Property.find call, you’d have @properties.

Hah, good point. Apologies for the obvious question.

Cheers,
Nick