TheOdinProject/theodinproject — pull request #91 by AbbyJonesDev (2014-06-18 03:26:47+00:00)
Title: Social sharing buttons

Pivotal Tracker ID: https://www.pivotaltracker.com/story/show/66463116
Deployed for manual testing to: http://thawing-caverns-7259.herokuapp.com/

Before this goes to production, the Facebook App ID will need to be changed to match an actual Odin Project app. Basic steps...
1.) Go to https://developers.facebook.com/ and create a new app. (If you haven't registered as a developer previously, you'll be prompted to agree to terms and register now.)
2.) On the Settings page for the new app, click "+ Add Platform" and select "Website." Fill in the App Domain (upper box) and website URL (lower box).
3.) On the same Settings page, add a contact email address
4.) On the Status & Review page - make the app public. (Slider at the very top of the page)
5.) Copy the app ID from the Settings page and paste it into the href for the Facebook sharing button. It's on line 6 of app/views/shared/_social_sharing_buttons.html.erb

I think that's all for setup...

I tried using the "parameterize" method on the lesson title. It worked for creating the url, but it works by downcasing the words and adding hyphens between them. Normally that would be fine, but in this case, the Pinterest message was also pre-populated with this downcased and hyphenated version of the lesson title. Not very pretty. My helper method is really simple, but it keeps the lesson title in its original format for the pre-populated message. There are a few tests to verify that it works as expected.

Testing for the buttons themselves is SO minimal. I'm only testing that the div shows up on the lessons page. I'd like to test that clicking it pops open a window with an appropriate URL and no errors, but that would mean hitting the servers every time the test suite is run. I also thought about using Fakeweb to catch the request and just verify that the URL is accurate, but I didn't. I might have had a good reason, but I think I'm just sleepy at this point. :)

Let me know if anything needs more attention.

Thanks!