-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Person’s Event page catch-up and test coverage
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
test/integration/gobierto_people/people/person_event_show_test.rb
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
require "test_helper" | ||
require_relative "base" | ||
|
||
module GobiertoPeople | ||
module People | ||
class PersonEventShowTest < ActionDispatch::IntegrationTest | ||
include Base | ||
|
||
def setup | ||
super | ||
@path = gobierto_people_person_event_path(person, event) | ||
end | ||
|
||
def site | ||
@site ||= sites(:madrid) | ||
end | ||
|
||
def person | ||
@person ||= gobierto_people_people(:richard) | ||
end | ||
|
||
def event | ||
@event ||= gobierto_people_person_events(:richard_published) | ||
end | ||
|
||
def test_person_event_show | ||
with_current_site(site) do | ||
visit @path | ||
|
||
assert has_selector?("h4", text: "#{person.name}'s agenda") | ||
assert has_selector?("h1", text: event.title) | ||
end | ||
end | ||
|
||
def test_event_attendees | ||
with_current_site(site) do | ||
visit @path | ||
|
||
within ".event-attendees" do | ||
event.attendees.each do |attendee| | ||
if attendee.person.present? | ||
assert has_link?(attendee.person.name) | ||
else | ||
assert has_content?(attendee.name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
def test_event_locations | ||
with_current_site(site) do | ||
visit @path | ||
|
||
within ".event-locations" do | ||
event.locations.each do |location| | ||
assert has_link?(location.name) | ||
assert has_content?(location.address) | ||
end | ||
end | ||
end | ||
end | ||
|
||
def test_subscription_block | ||
with_current_site(site) do | ||
visit @path | ||
|
||
within ".subscribable-box" do | ||
assert has_button?("Subscribe") | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |