-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show service areas on guest show partner page
- Loading branch information
1 parent
9851679
commit c5e061a
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
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,43 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
|
||
class PartnersHelperTest < ActionView::TestCase | ||
setup do | ||
@partner = FactoryBot.create(:partner) | ||
@hoods = [ | ||
FactoryBot.create(:neighbourhood, name: 'alpha'), | ||
FactoryBot.create(:neighbourhood, name: 'beta'), | ||
FactoryBot.create(:neighbourhood, name: 'cappa') | ||
] | ||
end | ||
|
||
# testing partner_service_area_text | ||
|
||
test "shows only one text correctly" do | ||
@partner.service_areas.create neighbourhood: @hoods[0] | ||
|
||
output = partner_service_area_text(@partner) | ||
|
||
assert output == 'alpha' | ||
end | ||
|
||
test "shows two texts correctly" do | ||
@partner.service_areas.create neighbourhood: @hoods[0] | ||
@partner.service_areas.create neighbourhood: @hoods[1] | ||
|
||
output = partner_service_area_text(@partner) | ||
|
||
assert output == 'alpha and beta' | ||
end | ||
|
||
test "shows N texts correctly" do | ||
@partner.service_areas.create neighbourhood: @hoods[0] | ||
@partner.service_areas.create neighbourhood: @hoods[1] | ||
@partner.service_areas.create neighbourhood: @hoods[2] | ||
|
||
output = partner_service_area_text(@partner) | ||
|
||
assert output == 'alpha, beta and cappa' | ||
end | ||
end |