forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added facebook reposts and user profile authorization
- Loading branch information
Showing
11 changed files
with
150 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,7 +294,7 @@ def test_twitter_send_checkbox_present | |
a = Factory(:authorization, :user => u) | ||
log_in(u, a.uid) | ||
|
||
assert_match page.body, /Tweet Me/ | ||
assert_match page.body, /Twitter/ | ||
end | ||
|
||
def test_twitter_send | ||
|
@@ -305,7 +305,7 @@ def test_twitter_send | |
log_in(u, a.uid) | ||
|
||
fill_in "text", :with => update_text | ||
check("tweeted") | ||
check("tweet") | ||
click_button "Share" | ||
|
||
assert_match /Update created/, page.body | ||
|
@@ -319,8 +319,7 @@ def test_twitter_no_send | |
log_in(u, a.uid) | ||
|
||
fill_in "text", :with => update_text | ||
uncheck("tweeted") | ||
|
||
uncheck("tweet") | ||
click_button "Share" | ||
|
||
assert_match /Update created/, page.body | ||
|
@@ -338,7 +337,7 @@ def test_no_twitter_no_send | |
assert_match /Update created/, page.body | ||
end | ||
|
||
def add_twitter_to_email_account | ||
def add_twitter_to_account | ||
u = Factory(:user) | ||
OmniAuth.config.add_mock(:twitter, { | ||
:uid => uid, | ||
|
@@ -358,6 +357,28 @@ def add_twitter_to_email_account | |
assert_equal "1234", u.twitter.oauth_token | ||
assert_equal "4567", u.twitter.oauth_secret | ||
end | ||
|
||
def add_facebook_to_account | ||
u = Factory(:user) | ||
OmniAuth.config.add_mock(:facebook, { | ||
:uid => uid, | ||
:user_info => { | ||
:name => "Joe Public", | ||
:email => "[email protected]", | ||
:nickname => u.username, | ||
:urls => { :Website => "http://rstat.us" }, | ||
:description => "A description", | ||
:image => "/images/something.png" | ||
}, | ||
:credentials => {:token => "1234", :secret => "4567"} | ||
}) | ||
log_in_no_twitter(u) | ||
visit "/users/#{u.username}/edit" | ||
click_button "Add Facebook Account" | ||
|
||
assert_equal "1234", u.twitter.oauth_token | ||
assert_equal "4567", u.twitter.oauth_secret | ||
end | ||
|
||
def test_facebook_username | ||
new_user = Factory.build(:user, :username => 'profile.php?id=12345') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,24 @@ def log_in_fb(u, uid = 12345) | |
end | ||
|
||
|
||
def log_in_facebook(u, uid = 12345) | ||
Author.any_instance.stubs(:valid_gravatar?).returns(:false) | ||
OmniAuth.config.add_mock(:facebook, { | ||
:uid => uid, | ||
:user_info => { | ||
:name => "Joe Public", | ||
:email => "[email protected]", | ||
:nickname => u.username, | ||
:urls => { :Website => "http://rstat.us" }, | ||
:description => "A description", | ||
:image => "/images/something.png" | ||
}, | ||
:credentials => {:token => "1234", :secret => "4567"} | ||
}) | ||
|
||
visit '/auth/twitter' | ||
end | ||
|
||
def log_in_no_twitter(user) | ||
User.stubs(:authenticate).returns(user).once | ||
visit "/login" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters