addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ruby-81] Problems with rspec and <xscript>ed DOM elements

From: Al C.
Sent on: Saturday, February 20, 2010 6:13 AM
I haven't done much view spec'ing, but the fact that we're dealing with what sounds like JavaScript DOM manipulation makes me wonder whether RSpec executes JavaScript. It's necessary (at least it used to be) to use an actual JavaScript executing browser (be it manually or automated via Watir, Selenium, etc.) in order to test JavaScript in Web apps.


On Feb 20, 2010, at 5:41 AM, Jon Seidel <[address removed]> wrote:

Hi... I'm using rSpec to develop my new site and I want to create a test to make sure that uservoice ( - a user feedback service) is being properly displayed... I am obviously missing something, as the following test fails:
require "spec_helper"

describe 'layouts/application­' do
 before do
   @user = Factory(:user)

 it "should have a Feedback link on the page" do
## This works...
   response.should have_tag("body")      
### Everything below fails...
   response.should have_tag("a#uservoic­e-feedback-tab", :text => "Open Feedback Tab")   
   response.should have_tag("a#uservoic­e-feedback-tab")
   response.should have_tag("div#uservo­ice-feedback")
   response.should have_text(/Feedback/­)
   response.should have_tag("div")    

I used FireBug to check what actually gets displayed on a live site and all of the failing examples should pass.

It's clearly my understanding of what is getting rendered because the have_tag("body":) works in test mode. I've checked the test html that is returned and it's only the layouts/application.­html.erb file -- no yield but more importantly, none of the uservoice scripting has been activated...

I looked at the uservoice script, and it has a window.onload which seems like it should activate the code when the example group starts... but it doesn't:

What am I missing?



Jon Seidel, CMC(r)
EDP Consulting, Inc. / /­   
Technology that means Business - Since 1979

Jon Seidel, CMC(r)
EDP Consulting, Inc. / /­   
Technology that means Business - Since 1979

Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jon Seidel ([address removed]) from The East Bay Ruby Meetup Group.
To learn more about Jon Seidel, visit his/her member profile: http://ruby.meetu...­
To unsubscribe or to update your mailing list settings, click here: http://ruby.meetu...­
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]


Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy