[rspec-users] Not seeing an RJS change

Nick Hoffman nick at deadorange.com
Sun Sep 28 17:20:05 EDT 2008

I'm writing specs for an XHR, and am having troubles getting my specs  
to see that a <div> is being hidden.

=== map_filter.rjs
  19 else
  20 puts "map_filter.rjs> else!"
  21   # Display the filter errors.
  22   page['map-filter-errors'].hide
  23   page['map-filter-errors'].replace_html @map_filter_errors.join
  24   page['map-filter-errors'].visual_effect :blind_down
  25 end

When the spec runs, line 20 above spits out "...else!" on the CLI, so  
I know that the RJS file is being processed.

=== neighbourhoods_controller_spec.rb
428       describe 'with views integrated' do
429         integrate_views
431         it 'should hide the map filter errors <div>' do
432           do_xhr @xhr_params
433           response.should have_rjs
434 #          response.should have_rjs(:hide, 'map-filter-errors')
435         end
436       end

Why might line 433 above fail?:

$ script/spec -e 'should hide the map filter errors <div>' spec/ 
map_filter.rjs> else!

'NeighbourhoodsController handling POST /neighbourhoods/map_filter if  
a filter error occured with views integrated should hide the map  
filter errors <div>' FAILED
No RJS statement that replaces or inserts HTML content.

Finished in 0.489336 seconds

1 example, 1 failure

Any hints?

More information about the rspec-users mailing list