954,562 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with the rspec test failing

ok, so here's the deal. Going over the Rails tutorial. We're running a testing environment to make sure that the things we want showing up on our pages are making it. Doing this using pages_controller_spec.rb file. And this is one of three arguments that we passed:

describe "GET 'home'" do
it "returns http success" do
get 'home'
response.should be_success
end
it "should have the right title" do
get 'home'
response.should has_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
end

All three tests are the same. When I run rspec spec/ from the command line (I'm using windows vista) I get this error on all three tests:


1) PagesController GET 'home' should have the right title
←[31mFailure/Error:←[0m ←[31mresponse.should have_selector("title",←[0m
←[31mNoMethodError:←[0m
←[31mundefined method `has_selector?' for #←[0m
←[36m # ./spec/controllers/pages_controller_spec.rb:13:in `block (3 levels)
in '←[0m

As you can see, I am not using anything called has_selector, but have_selector. Where is this coming from? Does anyone know how to fix it? I've checked over the code repeatedly for 2 days now to make sure that my example matches the video and that the text being checked for by rspec is identical on the actual web pages. I mean, heck, the pages even display properly after I start the server. So I am totally without a clue. The closest I came to an answer was on another forum where someone mentioned that they forgot to include the 'render_views' near the top after the first 'describe'. Double checked that too and I got it where it needs to be. *sad programmer*

Dante2
Light Poster
44 posts since Sep 2010
Reputation Points: 16
Solved Threads: 0
 

Ok, Sorry bout this if anyone has been looking at this. But I have come to the conclusion here that the problem is my own for trying to do this project from two different sources. I'm marking this as solved and starting the project over from scratch and tackling it from another angle using one source. Thanks to anyone who read this.

Dante2
Light Poster
44 posts since Sep 2010
Reputation Points: 16
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You