I found a potential solution from this blog: http://www.rubytutorials.net/2008/02/29/small-rspec-revelations-rjs/
In my spec for the view in which I want to include the AJAX functionality ("new.html.erb_spec.erb"), I have added a couple of Examples to drive out the some of the AJAX functionality: it "should render /Available/ if name does not exist" do @name_exists = false assigns[:name_exists] = @name_exists render "contexts/check.js.rjs" response.should have_rjs(:chained_replace_html, 'checkname') do response.should have_text(/Available/) end end it "should render /Not available/ if name does not exist" do @name_exists = true assigns[:name_exists] = @name_exists render "contexts/check.js.rjs" response.should have_rjs(:chained_replace_html, 'checkname') do response.should have_text(/Not available/) end end The rendered template "check.js.rjs" contains: if @name_exists page['checkname'].update('Not available') else page['checkname'].update('Available') end These examples pass and seem to achieve my objective of using the spec to drive out the required AJAX behaviour, or at least some of it. Though I suspect that this approach may have limitations for other types of AJAX functionality. At this stage, I am wondering whether it is worth trying to drive out any AJAX functionality at the point of writing RSpec view specs. Some replies seem to suggest the use of Cucumber with Culerity/Webrat/ Selenium and I read into this that one would bypass view specs for the AJAX related steps and just write the necessary view code (e.g. JavaScript or Rails Prototype helpers) to get the step to pass. Further thoughts appreciated. Thanks Lee. On 12 May, 18:47, Phlip <phlip2...@gmail.com> wrote: > David Chelimsky wrote: > > You could just say "be careful not to mock too much," which would be > > really good advice, > > Sorry; I thought I said that. This industry in general dislikes strong > opinions... > > Mock on, everyone! > > > but instead you make a generalizing and judgmental > > > statement like this. When's the last time you paired with someone in > > the RSpec community? > > Well it's not for want of trying! > > -- > Phlip > http://flea.sourceforge.net/resume.html > > _______________________________________________ > rspec-users mailing list > rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users