On Sat, Oct 11, 2008 at 2:19 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote:
> 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"
If you mocked the Property.find call, you'd have @properties.
///ark
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users