Skip to content
Browse files

Added facebooker fixture files for testing

  • Loading branch information...
1 parent 5fec6f4 commit 011a5a6013b9fc404c721484c34a1c2dad582b43 @nbibler nbibler committed Mar 5, 2010
View
3 generators/blue_light_special_tests/blue_light_special_tests_generator.rb
@@ -11,7 +11,8 @@ def manifest
"test/integration/sign_in_test.rb",
"test/integration/sign_out_test.rb",
"test/integration/sign_up_test.rb",
- "test/integration/password_reset_test.rb"].each do |file|
+ "test/integration/password_reset_test.rb",
+ "test/facebooker_fixtures/facebooker.users.getInfo/609e98c680f254540205acf931ae2963.xml"].each do |file|
m.file file, file
end
View
119 ...ates/test/facebooker_fixtures/facebook.users.getInfo/609e98c680f254540205acf931ae2963.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<users_getInfo_response xmlns="http://api.facebook.com/1.0/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true">
+ <user>
+ <uid>8055</uid>
+ <about_me>This field perpetuates the glorification of the ego. Also, it has a character limit.</about_me>
+ <activities>Here: facebook, etc. There: Glee Club, a capella, teaching.</activities>
+ <affiliations list="true">
+ <affiliation>
+ <nid>50453093</nid>
+ <name>Facebook Developers</name>
+ <type>work</type>
+ <status/>
+ <year/>
+ </affiliation>
+ </affiliations>
+ <birthday>November 3</birthday>
+ <books>The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar</books>
+ <current_location>
+ <city>Palo Alto</city>
+ <state>California</state>
+ <country>United States</country>
+ <zip>94303</zip>
+ </current_location>
+ <education_history list="true">
+ <education_info>
+ <name>Harvard</name>
+ <year>2003</year>
+ <concentrations list="true">
+ <concentration>Applied Mathematics</concentration>
+ <concentration>Computer Science</concentration>
+ </concentrations>
+ </education_info>
+ </education_history>
+ <email>bob@facebook.com</email>
+ <family list="true">
+ <family_elt list="true">
+ <family_elt_elt>mother</family_elt_elt>
+ <family_elt_elt>1394244902</family_elt_elt>
+ </family_elt>
+ <family_elt list="true">
+ <family_elt_elt>sister</family_elt_elt>
+ <family_elt_elt>48703107</family_elt_elt>
+ </family_elt>
+ <family_elt list="true">
+ <family_elt_elt>brother</family_elt_elt>
+ <family_elt_elt>1078767258</family_elt_elt>
+ </family_elt>
+ <family_elt list="true">
+ <family_elt_elt>brother</family_elt_elt>
+ <family_elt_elt>John Doe</family_elt_elt>
+ <family_elt_elt/>
+ </family_elt>
+ </family>
+ <first_name>Dave</first_name>
+ <hometown_location>
+ <city>York</city>
+ <state>Pennsylvania</state>
+ <country>United States</country>
+ </hometown_location>
+ <hs_info>
+ <hs1_name>Central York High School</hs1_name>
+ <hs2_name/>
+ <grad_year>1999</grad_year>
+ <hs1_id>21846</hs1_id>
+ <hs2_id>0</hs2_id>
+ </hs_info>
+ <is_app_user>1</is_app_user>
+ <has_added_app>1</has_added_app>
+ <interests>coffee, computers, the funny, architecture, code breaking,snowboarding, philosophy, soccer, talking to strangers</interests>
+ <last_name>Fetterman</last_name>
+ <locale>en_US</locale>
+ <meeting_for list="true">
+ <seeking>Friendship</seeking>
+ </meeting_for>
+ <meeting_sex list="true">
+ <sex>female</sex>
+ </meeting_sex>
+ <movies>Tommy Boy, Billy Madison, Fight Club, Dirty Work, Meet the Parents, My Blue Heaven, Office Space </movies>
+ <music>New Found Glory, Daft Punk, Weezer, The Crystal Method, Rage, the KLF, Green Day, Live, Coldplay, Panic at the Disco, Family Force 5</music>
+ <name>Dave Fetterman</name>
+ <notes_count>0</notes_count>
+ <pic>http://photos-055.facebook.com/ip007/profile3/1271/65/s8055_39735.jpg</pic>
+ <pic_big>http://photos-055.facebook.com/ip007/profile3/1271/65/n8055_39735.jpg</pic_big>
+ <pic_small>http://photos-055.facebook.com/ip007/profile3/1271/65/t8055_39735.jpg</pic_small>
+ <pic_square>http://photos-055.facebook.com/ip007/profile3/1271/65/q8055_39735.jpg</pic_square>
+ <political>Moderate</political>
+ <profile_update_time>1170414620</profile_update_time>
+ <quotes/>
+ <relationship_status>In a Relationship</relationship_status>
+ <religion/>
+ <sex>male</sex>
+ <significant_other_id xsi:nil="true"/>
+ <status>
+ <message>Fast Company, November issue, page 84</message>
+ <time>1193075616</time>
+ </status>
+ <timezone>-8</timezone>
+ <tv>cf. Bob Trahan</tv>
+ <wall_count>121</wall_count>
+ <website>http://www.example.com</website>
+ <work_history list="true">
+ <work_info>
+ <location>
+ <city>Palo Alto</city>
+ <state>CA</state>
+ <country>United States</country>
+ </location>
+ <company_name>Facebook</company_name>
+ <position>Software Engineer</position>
+ <description>Tech Lead, Facebook Platform</description>
+ <start_date>2006-01</start_date>
+ <end_date/>
+ </work_info>
+ </work_history>
+ </user>
+ </users_getInfo_response>
+
View
8 generators/blue_light_special_tests/templates/test/integration/facebook_test.rb
@@ -10,7 +10,7 @@ class FacebookTest < ActionController::IntegrationTest
Facebooker::MockService.fixture_path = File.dirname(__FILE__) + '/../facebooker_fixtures'
fb_session = Facebooker::MockSession.create
fb_session.secure!
- CitiesController.any_instance.stubs(:facebook_session).returns(fb_session)
+ BlueLightSpecial::PasswordsController.any_instance.stubs(:facebook_session).returns(fb_session)
end
should 'find an existing user with the facebook uid' do
@@ -22,21 +22,21 @@ class FacebookTest < ActionController::IntegrationTest
:display_name => 'Bob Jones',
:zip_code => '11111')
- visit city_url(City.default)
+ visit new_password_url
assert controller.signed_in?
assert_equal controller.current_user, user
end
should 'create a new user when the facebook uid is not found' do
assert_nil User.find_by_facebook_uid(8055)
- visit city_url(City.default)
+ visit new_password_url
assert controller.signed_in?
assert_equal controller.current_user.facebook_uid, 8055
end
should 'copy the facebook user details' do
- visit city_url(City.default)
+ visit new_password_url
assert controller.signed_in?
assert_equal controller.current_user.first_name, 'Dave'
assert_equal controller.current_user.last_name, 'Fetterman'
View
9 generators/blue_light_special_tests/templates/test/integration/password_reset_test.rb
@@ -41,11 +41,12 @@ class PasswordResetTest < ActionController::IntegrationTest
request_password_reset(@user.email)
@user.reload # catch updated confirmation token
Delayed::Job.work_off
- sent = ActionMailer::Base.deliveries.last
- assert_equal @user.email, sent.recipients
- assert_match /password/i, sent.subject
assert !@user.password_reset_token.blank?
- assert_match /#{@user.password_reset_token}/, sent.body[:url]
+ assert_email_sent do |email|
+ email.recipients =~ /#{Regexp.escape @user.email}/i &&
+ email.subject =~ /password/i &&
+ email.body[:url] =~ /#{Regexp.escape @user.password_reset_token}/
+ end
end
end
View
8 shoulda_macros/blue_light_special.rb
@@ -81,14 +81,6 @@ def should_create_user_successfully
warn "[DEPRECATION] should_create_user_successfully: not meant to be public, no longer used internally"
should_assign_to :user
should_change 'User.count', :by => 1
-
- should "send the confirmation email" do
- assert_sent_email do |email|
- email.subject =~ /account confirmation/i
- end
- end
-
- should_set_the_flash_to /confirm/i
should_redirect_to_url_after_create
end

0 comments on commit 011a5a6

Please sign in to comment.
Something went wrong with that request. Please try again.