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.
Extract a test helper method for following a remote user
- Loading branch information
1 parent
28e897c
commit a87c1a0
Showing
1 changed file
with
17 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,30 +4,36 @@ | |
describe "following remote users" do | ||
include AcceptanceHelper | ||
|
||
def follow_remote_user!(webfinger_id = "[email protected]") | ||
visit "/" | ||
click_link "Follow Remote User" | ||
|
||
VCR.use_cassette('subscribe_remote') do | ||
fill_in 'subscribe_to', :with => webfinger_id | ||
click_button "Follow" | ||
end | ||
end | ||
|
||
describe "success" do | ||
before do | ||
log_in_as_some_user | ||
visit "/" | ||
click_link "Follow Remote User" | ||
|
||
VCR.use_cassette('subscribe_remote') do | ||
fill_in 'subscribe_to', :with => "[email protected]" | ||
click_button "Follow" | ||
end | ||
end | ||
|
||
it "follows users on other sites" do | ||
follow_remote_user! | ||
assert_match "Now following steveklabnik.", page.body | ||
assert "/", current_path | ||
end | ||
|
||
it "has users on other sites on /following" do | ||
follow_remote_user! | ||
visit "/users/#{@u.username}/following" | ||
|
||
assert_match "steveklabnik", page.body | ||
end | ||
|
||
it "unfollows users from other sites" do | ||
follow_remote_user! | ||
visit "/users/#{@u.username}/following" | ||
|
||
VCR.use_cassette('unsubscribe_remote') do | ||
|
@@ -37,20 +43,11 @@ | |
assert_match "No longer following steveklabnik", page.body | ||
end | ||
|
||
it "only creates one Feed per remote_url" do | ||
log_in_as_some_user | ||
visit "/" | ||
click_link "Follow Remote User" | ||
|
||
assert_match "OStatus Sites", page.body | ||
|
||
VCR.use_cassette('subscribe_remote') do | ||
fill_in 'subscribe_to', :with => "[email protected]" | ||
click_button "Follow" | ||
end | ||
|
||
visit "/users/#{@u.username}/following" | ||
it "doesn't follow those you already follow, and reports an error" do | ||
follow_remote_user! | ||
follow_remote_user! | ||
|
||
assert has_content? "You're already following steveklabnik." | ||
assert_match "Unfollow", page.body | ||
end | ||
end | ||
|