Skip to content

Commit

Permalink
Person’s Event page catch-up and test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
danguita committed Jan 17, 2017
1 parent e1b6b5d commit 6bff12d
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions test/integration/gobierto_people/people/person_event_show_test.rb
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

0 comments on commit 6bff12d

Please sign in to comment.