Conversation
spec/features/managing_venue_spec.rb
Outdated
There was a problem hiding this comment.
Any value in checking the updates succeeded?
There was a problem hiding this comment.
This was the last bit I worked on at the code sprint. I intend on adding the page.should have_value stuff soon.
There was a problem hiding this comment.
Cool. Do you want to add to this PR or open a new one with those additions? Either way works for me.
There was a problem hiding this comment.
I'll just add to this PR when it's done. It shouldn't take too long.
|
Okay. So I've added the expectations for venue editing. There are a few boxes in both creation and editing that I've commented out because I'm either unsure about how to test them or whether they should even exist. Mainly, that's Venue tags like #230, and things like Lat/Long and the Geocoding checkbox. In addition, I've used the new |
|
Hmm, that spec fails. Might have something to do with Also, we should probably use a factory here as a test harness. Want to give that a go? |
|
I got a bit ahead of myself. I'll get this cleaned up and comment again. The closed check box is likely the hang point. |
|
Well, it looks like the address editing is the actual hang point.
Also, I'm still a new Rails developer. Could you clarify what you mean by using a factory as a test harness? @jc00ke |
|
Alright. So address editing is solved for the moment, though I think there are some systemic changes that could be made to the Venue Edit form to make it cleaner. I'm still unsure of how to use a factory as a test harness. Input welcome. |
spec/features/managing_venue_spec.rb
Outdated
There was a problem hiding this comment.
Need to remove this require.
There was a problem hiding this comment.
Thanks. I pulled the gems back out but forgot the require.
|
Cool, looks like the specs pass! As for using the factories, we can use the feature 'Venue Editing' do
let(:venue) { create(:venue) }
let(:new_venue) { build(:venue) } # <-- building out a test harness
scenario 'A user edits an existing venue' do
visit "/venues/#{venue.id}"
click_on 'edit'
find_field('Venue Name').value.should have_content "#{venue.title}"
fill_in 'Venue Name', with: new_venue.name
# ...
check('venue_wifi') if new_venue.wifi
# ...
check('venue_closed') if new_venue.closed
click_on 'Update Venue'
expect(page).to have_content 'Venue was successfully saved.'
expect(page).to have_content new_venue.name
# ...
expect(page).to have_content 'Public WiFi'
expect(page).to have_content 'This venue is no longer open for business.'
end
end |
spec/features/add_venue_spec.rb
Outdated
There was a problem hiding this comment.
We should use venue_path here.
|
@nblackburn87 this PR is taking shape! |
|
@jc00ke I see what we're doing here. The code takes the form it does right now because I was following the format of |
|
Yes, I do think we should rewrite those specs, but let's wrap up this PR first, then tackle refactoring the others. Hard-coding those values ends up being a pain later, when one needs to change the specs. That's the main reason I'm advocating we switch. Not a huge deal though. |
|
Cool. I can definitely do it, I just wanted to check and make sure that was the plan. I see the value of this over hardcoded responses for sure. |
|
Well, the specs still pass with the harness, which is good. The relative pathing is causing problems though. I've been off in Python land and so it's been a bit since I touched this much Rails and the relative routes are coming back slowly. The larger issue is that Calagator's
The |
|
Hmm, it might be that the url helpers aren't available in the request features. See this SO answer for more details. We can handle that in a separate PR. So, to wrap up this PR, push the use of factories and then we'll go from there. Ideally we'd squash these commits into a single commit, but it might be easier to open up a new PR with a clean commit. Your call. |
|
It looks like that's exactly what's up. I tried a few different searches but I guess I didn't ask the right thing. Pushing the factories. |
|
@jc00ke Hmm. Travis errors on Ruby 2.0.0 with Postgres. Everything else is green. Travis docs seem to suggest that this is fine. |
|
Yeah, it's a shame the build errors when solr can't start up. I'll open a separate issue for that. |
|
Cool, this looks good! Squash into one commit and I'll merge! |
|
Use |
|
In cases like this, where ideally this would have been a single commit |
|
I'm wondering what the value of squashing is here. I understand it's nice to keep things tidy, commit history-wise, but I also would like to balance this with not rewriting history when we don't need to. I also wonder about asking one contributor to squash when it seems to not be asked of others. Especially since one of the core tenets of this project is to help newcomers to open source, and those little green boxes can be really motivating. Maybe we need a clear contribution guideline on this documented somewhere, so contributors know what to expect from the beginning? @reidab, @aeschright, @jc00ke thoughts? |
|
In this case I would squash these commits 1) to keep the history clean, as you mentioned and 2) to avoid committing into master code that is known to fail. We aren't rewriting history yet... if we rebased I'd have to see specific examples, but most PR's don't need to be squashed. Incrementally developing or refactoring a feature doesn't necessarily warrant squashing. That being said, I do suppose the merge commit gives us a single point to revert, should we want/need to in the future (not with this PR, just in general) Guidelines would be nice. I wrote some up for Rubinius a while back and they've helped encourage new contributors to contribute in a productive way. I'm not sure how exactly we would address squashing, since it comes up rarely, but maybe we should. My goal in giving feedback was to help make the final product, the code that actually gets merged back into master, as good as it can be. Beyond squashing, I've mentioned several times that a new PR could be opened. I've seen that tactic used on several other notable projects, and it's one I've used myself. For me, a clean, understandable history is important. It communicates intent in its own way. I'd love to hear the thoughts of others. |
|
Please understand. I'm not suggesting we do anything that might harm the project and I'm open to squashing some or all the commits if that's what really should be done. Perhaps just the failed builds? I think that it's very possible to squash some things while still giving some sense of the steps I took and how this PR progressed. One of my goals at the moment as a very new developer is not just to work on projects (though that's valuable) but also to build a history on open source projects and elsewhere. With this in mind I'd prefer to not have this end up as just one commit on my personal history. Perhaps that's not the most noble goal but it's where I am. |
|
OK, I see where you're coming from now... sorry it took me so long! I didn't think of this being an addition to your personal history; an oversight on my part. That's something I'll have to look for in the future. |
|
Oh wow. I was feeling very anxious about this and I'm glad you understood my point of view. Thanks so much @jc00ke |
|
Thank you @nblackburn87! I certainly never meant for you to feel anxious. I'm glad we got this sorted out. |
Testing venue creation and editing following the style of Events.
This is still a work in progress. Chat is still welcome. :)