SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Oct 27, 2008, 03:34 #1
- Join Date
- Sep 2008
- Posts
- 7
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
shovell p.243 test fails, browser view works
simply rails 2, chapter 7, p.243 the second stories_controller_test.rb is:
def test_should_show_story_votes_elements
get :show, :id => storiesone)
assert_select 'h2 span#vote_score'
assert_select 'ul#vote_history li', :count => 2
assert_select 'div#vote_form form'
end
when the rake test run it shows failure on the bold marked line. here it is:
1) Failure:
test_should_show_story_votes_elements(StoriesControllerTest)
[C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_con
troller/assertions/selector_assertions.rb:296:in `assert_select'
./test/functional/stories_controller_test.rb:46:in `test_should_show_story_
votes_elements'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_
support/testing/default.rb:7:in `run']:
Expected at least 2 elements matching "ul#vote_history li", found 0.
<false> is not true.
the puzling thing about it is that it shows well on the browser, and 'shoving' the story again and again show well new scores and a refreshed vote_history list.
what is wrong here? any body knows?
-
Oct 27, 2008, 06:06 #2
- Join Date
- Sep 2008
- Posts
- 7
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
As a matter of fact it does not show on the broser too I was confused by the voting that clicking works fine, and the Ajax too, and than it shows the vote_history too. But when a story is entered first through 'http://localhost:3000/stories/2', the vote_history does not show. There is a small empty grey square with darker border that remind me there should have been vote_history there. It does, though, show the line 'No shoves yet!' when that is true. So it is not only test failure, it is a functional real problem Please HELP!
-
Oct 27, 2008, 11:39 #3
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
Does your test\fixtures\stories.yml file look like
Code:# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html one: name: My shiny weblog link: http://poocs.net/ two: name: SitePoint Forums link: http://www.sitepoint.com/forums/
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Oct 27, 2008, 13:15 #4
- Join Date
- Sep 2008
- Posts
- 7
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the try, and for the link, I'll study it.
But as I mentioned in the additional note this was a REAL problem, not only test failure.
so I tested the <ul> section on the show.html.erb by reversing the condition (!) and the tasks, and what I saw in the browser was a different problem, but such that proved I hit the spot. The examination of the section again revealed there was a typo in the else condition. I typed it like that < else > istead of <% else %>.
Now the test is perfect, and so is the show in the browser.
Anyway - Thanks a lot for the bother.
Bookmarks