1 require "application_system_test_case"
3 class DashboardSystemTest < ApplicationSystemTestCase
4 test "show no users if have no followings" do
9 assert_text "You have not followed any user yet."
12 test "show users if have friends" do
13 user = create(:user, :home_lon => 1.1, :home_lat => 1.1)
14 friend_user = create(:user, :home_lon => 1.2, :home_lat => 1.2)
15 create(:follow, :follower => user, :following => friend_user)
16 create(:changeset, :user => friend_user)
20 assert_no_text "You have not followed any user yet."
22 friends_heading = find :element, "h2", :text => "Followings"
23 others_heading = find :element, "h2", :text => "Other nearby users"
25 assert_link friend_user.display_name, :below => friends_heading, :above => others_heading
28 test "show nearby users with ability to follow" do
29 user = create(:user, :home_lon => 1.1, :home_lat => 1.1)
30 nearby_user = create(:user, :home_lon => 1.2, :home_lat => 1.2)
35 within_content_body do
36 others_nearby_heading = find :element, "h2", :text => "Other nearby users"
38 assert_no_text "There are no other users who admit to mapping nearby yet"
39 assert_link nearby_user.display_name, :below => others_nearby_heading
40 assert_link "Follow", :below => others_nearby_heading
44 followings_heading = find :element, "h2", :text => "Followings"
45 others_nearby_heading = find :element, "h2", :text => "Other nearby users"
47 assert_text "There are no other users who admit to mapping nearby yet"
48 assert_link nearby_user.display_name, :below => followings_heading, :above => others_nearby_heading
49 assert_link "Unfollow", :below => followings_heading, :above => others_nearby_heading