Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for questions count on methods page #2621

Merged
merged 6 commits into from
Apr 18, 2018
Merged

Conversation

jywarren
Copy link
Member

No description provided.

@PublicLabBot
Copy link

PublicLabBot commented Apr 16, 2018

2 Messages
📖 @jywarren Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.
📖 This pull request doesn’t link to a issue number. Please refer to the issue it fixes (if any) in the body of your PR, in the format: Fixes #123.

Generated by 🚫 Danger

@jywarren
Copy link
Member Author

@publiclab/reviewers - this is odd -- our Danger test failures for assert_select seem to be showing this error instead of indicating what was matched/not matched. Has anyone else seen this?

@@ -558,6 +558,16 @@ def teardown
assert_not_nil :topics
end

test 'should get methods page and show questions count' do
nodes(:method).add_tag('questions:spectrometer', users(:bob))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jywarren ...see this line :

tagname = node.power_tag('questions')

undefined local variable , right ?

@sagarpreet-chadha
Copy link
Contributor

Okay , so i think nodes(:method) does not contains tag method so i added this line :
nodes(:method).add_tag('method', users(:bob)) .

Then i used id instead of class in the <span> tag in _notes.html.erb:44

And then in assert_select i changed to :
assert_select "#questions-count-#{nodes(:method).id}", "#{nodes(:method).questions.count} questions" .

and the test passed ! What do you think ?

@sagarpreet-chadha
Copy link
Contributor

sagarpreet-chadha commented Apr 17, 2018

@jywarren ....when i used id instead of class , the travis showed the correct error of what was matched/unmatched.
I guess when we used class then assert_select returns array of classes (in our case array has 1 item) and hence there was a different error earlier.

@jywarren
Copy link
Member Author

Oh, this is awesome. Do you think you could add a commit to this PR?

Thank you so much for helping out! 🙌 🤝

@jywarren
Copy link
Member Author

Oh wow you already did! My browser tab just hadn't refreshed. AMAZING TEAMWORK!!! 🎈🎈🎈🎈🎈🎈🎈🎈🎈

@jywarren jywarren merged commit 232bf1b into master Apr 18, 2018
@em1 em1 mentioned this pull request Jun 3, 2018
5 tasks
SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
* Add test for questions count on methods page

* Update wiki_controller_test.rb

* Update _notes.html.erb

* Added tag 'method' also .

* changed class to id of span .

* Removed undefined local variable .
@emilyashley emilyashley deleted the questions-methods branch January 15, 2020 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants