Problems with rspec and <xscript>ed DOM elements

From: Jon S.
Sent on: Saturday, February 20, 2010 5:41 AM
Hi... I'm using rSpec to develop my new site and I want to create a test to make sure that uservoice (www.uservoice.com - 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)
    template.stub(:curre­nt_user).and_return(­@user)
    render 
  end

  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")    
    end
end
===================

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?

Thanks...jon

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

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