-
Notifications
You must be signed in to change notification settings - Fork 32
/
person_profile_test.rb
87 lines (70 loc) · 1.88 KB
/
person_profile_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# frozen_string_literal: true
require "test_helper"
require_relative "people/base"
module GobiertoPeople
class PersonProfileTest < ActionDispatch::IntegrationTest
include People::Base
def setup
super
@path = gobierto_people_person_path(person.slug)
end
def site
@site ||= sites(:madrid)
end
def user
@user ||= users(:peter)
end
def person
@person ||= gobierto_people_people(:richard)
end
def test_person_profile
with_current_site(site) do
visit @path
assert has_selector?("h2", text: person.name)
assert has_selector?(".person_charge", text: person.charge)
end
end
## TODO: fix this random failing test
## def test_upcoming_events_block
## with_current_site(site) do
## visit @path
##
## within ".upcoming-events" do
## assert has_link? "Future government event"
## assert has_link? "Invited event"
## assert has_link?("View all")
## end
## end
## end
def test_latest_activity_block
with_current_site(site) do
visit @path
within ".latest-activity" do
assert has_content?("This profile has not registered any activity yet.")
end
end
end
def test_subscription_block
with_current_site(site) do
visit @path
within ".subscribable-box", match: :first do
assert has_button?("Subscribe")
end
end
end
def test_subscription_block
with_javascript do
with_signed_in_user(user) do
visit @path
within ".slim_nav_bar" do
assert has_link? "Follow person"
end
click_on "Follow person"
assert has_link? "Person followed!"
click_on "Person followed!"
assert has_link? "Follow person"
end
end
end
end
end