-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Separate question posting form temp fixes #910 #944
Separate question posting form temp fixes #910 #944
Conversation
Checking out your cloud9 setup -- wasn't clear if it seems to run |
|
This looks good - and at some point, we should add a test for the test "/questions/new form loads" do
get :new
assert_response :success
end I think? |
Thanks for checking things out! I thought I had run For the /questions/new test should that be just be added at the end of the other tests or is there a better place to insert that? Will I run into issues since you did the changes on my master branch? I don't want to have merge conflicts if I change something on my branch...lol...causes me stress :-) |
Yes, at the end sounds great. At some point we could try to re-order the On Wed, Nov 2, 2016 at 3:54 PM, Sandy notifications@github.com wrote:
|
Merge branch 'master' of https://github.com/publiclab/plots2
I have added the /question/new test...but looks like this is still failing in TravisCI:
|
You know, I believe that test on line 33 of |
@@ -45,8 +45,10 @@ def setup | |||
tags: 'question:question,one', | |||
template: 'question', | |||
redirect: 'question' | |||
assert_select "h3", "Ask a question of the community" | |||
assert_select "input#taginput[value=?]", "question:question,one" | |||
assert_response :redirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to worry about details, but if you could adjust this indent (two spaces per indent) that'd be great. It's helpful when the whole codebase has really standardized formatting. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, just to be clear, if it matches level of indent of the line below it that'd be perfect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry about details too :-) So all the assert lines should line up? And do you want me to actually delete the 2 lines I commented out:
assert_select "h3", "Ask a question of the community"
assert_select "input#taginput[value=?]", "question:question,one"
I commented them out just cause the original issue didn't seem clear about whether or not they should be out or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, unless you want to try modifying them to fit your new template -- and in fact, both may still work, since your template is almost identical to the previous one. Each looks for an HTML element (h3
or input
) and the second also looks to see that the <input>
it finds has the specified value. They will actually reference these two lines in your new template:
- https://github.com/publiclab/plots2/pull/944/files#diff-4be9cc3eba98e96c36dddfafeae8a472R78
- https://github.com/publiclab/plots2/pull/944/files#diff-4be9cc3eba98e96c36dddfafeae8a472R95
So, try uncommenting them to see if they pass!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly they don't seem to pass when I uncomment them either. And as far as I can tell the h3
is there...the <input>
I am not entirely sure on but seems to be referencing tags with questions so sort of at a loss.
Regarding the login_flow_test, I'm not actually sure of that one, and it could be a bit of a puzzler. I'm wondering if the redirect happens at all? We do assert_response :redirect
assert_redirected_to '/questions/new' ...just as you did in the other test, at least we'll know that redirecting is working... |
Ah, I remembered that you can't select things after a redirect in a On Nov 3, 2016 7:02 PM, "Sandy" notifications@github.com wrote:
|
Merge branch 'master' of https://github.com/publiclab/plots2
I have commented out the
into the login_flow_test file. Which didn't seem to help the problem either. I was getting a failure about the input#title so I ended up commenting out these two lines:
which managed to get the tests I ran locally not to have any failures but still had errors:
So not sure if that means we are making progress or not :-) |
Ah - well, that's caused by this line: And could probably be solved by checking if redirect_to '/questions/new' if params[:tags] && params[:tags].include?("question:") Make sense? Also -- even if it causes an error, pushing up another commit lets me be sure that the code I'm looking at in your PR is the same as what's causing the errors, so that can be helpful. But it was unnecessary in this case, just mentioning! Thanks for your patience on this one, sometimes a small change ricochets through the tests -- but it's good that we catch these issues! |
Merge branch 'master' of https://github.com/publiclab/plots2
Might be getting somewhere :-) Down to one error...
|
Hmm, i'm not actually sure -- i thought just having a template would create an implicit method for Can you try just adding a blank method for it? def new
end into the questions controller? |
Adding the blank 'new' method still doesn't quite work...gives me this:
Question (beware possibly total newb question :-) )...the original issue said to:
Is that error looking for a template in 'questions/new' views? |
Aha, great catch! You're right -- we need to tell the method where to find the template, since it's under the def new
render "questions/new"
end I think that's right -- fingers X!! |
I had high hopes but 👎
I guess I am a little confused...wouldn't we want to do:
Where as this:
suggests to me that there would be a file called new.html.erb in the directory questions? |
Merge branch 'master' of https://github.com/publiclab/plots2
You're right again... I think i've been looking at too many Github issues On Fri, Nov 4, 2016 at 2:41 PM, Sandy notifications@github.com wrote:
|
Does that mean I would need to change all the instances of 'questions/new' that I have inserted into the various other places? Or does that mean it might be easier to create the template in questions/new.html.erb? |
No, I believe the route will remain the same -- this |
Rails defaults like this can trip you up... although Rails is very powerful, when you break a convention (like putting the template in a different place) it can get a little complex. I guess I felt we should keep all the posting forms next to one another, though! |
Didn't quite fix it...but we have a new error: Error: test_/questions/new_form_loads(QuestionsControllerTest): ActionView::Template::Error: undefined method
|
Ah, i think perhaps we have to log in to view the form, so adding this as the first line of the test on line 164 would do that: UserSession.create(rusers(:bob)) Make sense? I hope this is the last thing! |
For reference, see how we do that here? https://github.com/sandyvern/plots2/blob/4921332a9371626a50f2bb26b77f487ef940d762/test/functional/questions_controller_test.rb#L155 |
I have added the UserSession line to the test and it seems to have worked locally...until it got to the Solr tests which had 2 failures. |
OK - well, for the TravisCI tests, maybe you're not doing As for the Solr tests, you shouldn't need to run them yourself; regular Thanks, Sandy!!! On Nov 4, 2016 8:44 PM, "Sandy" notifications@github.com wrote:
|
4921332
to
bd128e4
Compare
I guess I didn't know about |
Yay!! They passed finally!! :-) Thanks for being patient with me and my newb issues! |
Oh, i'm sorry if it wasn't clearly documented -- any suggestions of a way to make that more clear to folks? It's easy to overlook things when you're writing documentation so we appreciate the tips. And SUPER!!! I'll look this over one more time and merge pretty soon. Thanks a million for your patience and persistence on this one -- we really appreciate it! I hope it wasn't too frustrating and that you'll consider taking on a new project with us soon! |
Wasn't too frustrating at all...kind of enjoyed it :-) And will definitely look for other projects to contribute to. As far as The other thing you might consider adding to that workflow is what to do when you rebase the master branch when there is a difference...never exactly sure what I should be doing...like adding another commit message, exiting that screen, then choosing y/n...so it might be a little confusing to first-timers/newbies. |
@sandyvern We're planning to do major changes in the README, simplifying instructions and making every instruction simple and foolproof. We'll make sure to include everything. Considering the rebase, I've always used the following:
|
Excellent -- squashed and merged manually in a564ffd -- i added one more change to preserve the URL parameters. This is super, thanks so much! |
Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks!
rake test:all
schema.rb.example
has been updated if any database migrations were addedPlease be sure you've reviewed our contribution guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software
We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays. Please alert developers on plots-dev@googlegroups.com when your request is ready or if you need assistance.
Thanks!