Plots2: Test `test_tag_index(TagControllerTest)` fails

Created on 26 Jul 2017  路  9Comments  路  Source: publiclab/plots2

What happened just before the problem occurred

Running rake test on the master branch seems to be failing one test. test_tag_index(TagControllerTest)- test_tag_index(TagControllerTest) test/functional/tag_controller_test.rb:114:in block in <class:TagControllerTest

Failure:
  <[#<Tag tid: 11, vid: 0, name: "upgrade:latest", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 10, vid: 0, name: "activity:coding", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 14, vid: 0, name: "activity:spectrometer", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 2, vid: 0, name: "awesome", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 9, vid: 0, name: "blog", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 5, vid: 0, name: "chapter", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 7, vid: 0, name: "lat:71.0", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 8, vid: 0, name: "lon:52.0", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 6, vid: 0, name: "question:spectrometer", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 12, vid: 0, name: "spectrometer", description: nil, weight: 0, count: nil, parent: "spectrometry">,
   #<Tag tid: 1, vid: 0, name: "test", description: nil, weight: 0, count: nil, parent: nil>,
   #<Tag tid: 16, vid: 0, name: "activities:spectrometer", description: nil, weight: 0, count: nil, parent: nil>]> expected but was
  <[#<Tag tid: 16, vid: 0, name: "activities:spectrometer", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 10, vid: 0, name: "activity:coding", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 14, vid: 0, name: "activity:spectrometer", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 2, vid: 0, name: "awesome", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 9, vid: 0, name: "blog", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 5, vid: 0, name: "chapter", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 7, vid: 0, name: "lat:71.0", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 8, vid: 0, name: "lon:52.0", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 6, vid: 0, name: "question:spectrometer", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 12, vid: 0, name: "spectrometer", description: nil, weight: 0, count: nil, parent: "spectrometry">, #<Tag tid: 1, vid: 0, name: "test", description: nil, weight: 0, count: nil, parent: nil>, #<Tag tid: 11, vid: 0, name: "upgrade:latest", description: nil, weight: 0, count: nil, parent: nil>]>.
test_tag_index(TagControllerTest)
test/functional/tag_controller_test.rb:114:in `block in <class:TagControllerTest>


Browser, version, and operating system

Mac OS Sierra - 10.12.5

bug fto-candidate help wanted testing

Most helpful comment

Yes sir you are correct , this remedy solves the problem .

All 9 comments

This looks like an ordering issue -- the test specifies:

assert_equal assigns['tags'].sort_by(&:count), assigns['tags']

But count seems to be nil in both cases, so it doesn't know how to sort. This happened because in the test data, none of the nodes have been "viewed" -- so they don't have a count (my best guess).

I think we need to simply sort both tid with .sort_by(&:tid) and they should then be equal. Could you open a pull request with that change on line 114 of test/functional/tag_controller_test.rb ?

Thank you!

@jywarren Happy to jump on this if no one is taking a look!

@kkavita92 sure, give it a try!

Let us know if you face any issues with this issue or with the project in general.

@ryzokuken Thanks, will get back to you with something in a couple of days 馃憤

I wasn't able to reproduce this, so maybe the first thing to check is if you see this error when you run tests at all. If not, and if nobody else can reproduce this, we might close it for now! Thanks!!

screen shot 2017-10-19 at 2 22 05 am

@jywarren sir...while testing i encountered the same test failing . Can i work on this ?

Cool, have you tried the remedy I proposed above?

sort both tid with .sort_by(&:tid)

Seems like that could resolve the issue. Please give it a try!

Yes sir you are correct , this remedy solves the problem .

Super, merged!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keshavsethi picture keshavsethi  路  3Comments

milaaraujo picture milaaraujo  路  3Comments

keshavsethi picture keshavsethi  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

bronwen9 picture bronwen9  路  3Comments