Skip to content

Commit

Permalink
Extract a test helper method for following a remote user
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Nov 16, 2012
1 parent 28e897c commit a87c1a0
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions test/acceptance/following_remote_users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a87c1a0

Please sign in to comment.