-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up failing test for facility reviews as well as fabricators for a…
…ll the other stuff
- Loading branch information
1 parent
123fd5b
commit d15f602
Showing
10 changed files
with
184 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
Fabricator(:facilities_category) do | ||
facility | ||
facility_category | ||
end | ||
|
||
# == Schema Information | ||
# | ||
# Table name: facilities_categories | ||
# | ||
# id :bigint not null, primary key | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# facility_category_id :bigint not null | ||
# facility_id :bigint not null | ||
# | ||
# Indexes | ||
# | ||
# index_facilities_categories_on_facility_category_id (facility_category_id) | ||
# index_facilities_categories_on_facility_id (facility_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (facility_category_id => facility_categories.id) | ||
# fk_rails_... (facility_id => facilities.id) | ||
# |
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,31 @@ | ||
# frozen_string_literal: true | ||
|
||
Fabricator(:space_facility) do | ||
facility | ||
relevant true | ||
experience :unknown | ||
end | ||
|
||
# == Schema Information | ||
# | ||
# Table name: space_facilities | ||
# | ||
# id :bigint not null, primary key | ||
# description :string | ||
# experience :integer | ||
# relevant :boolean default(FALSE) | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# facility_id :bigint not null | ||
# space_id :bigint not null | ||
# | ||
# Indexes | ||
# | ||
# index_space_facilities_on_facility_id (facility_id) | ||
# index_space_facilities_on_space_id (space_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (facility_id => facilities.id) | ||
# fk_rails_... (space_id => spaces.id) | ||
# |
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,27 @@ | ||
# frozen_string_literal: true | ||
|
||
Fabricator(:space_types_facility) do | ||
space_type | ||
facility | ||
end | ||
|
||
# == Schema Information | ||
# | ||
# Table name: space_types_facilities | ||
# | ||
# id :bigint not null, primary key | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# facility_id :bigint not null | ||
# space_type_id :bigint not null | ||
# | ||
# Indexes | ||
# | ||
# index_space_types_facilities_on_facility_id (facility_id) | ||
# index_space_types_facilities_on_space_type_id (space_type_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (facility_id => facilities.id) | ||
# fk_rails_... (space_type_id => space_types.id) | ||
# |
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,46 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
describe "User creates facility reviews", :js do | ||
let!(:space) do | ||
Fabricate(:space, address: "Ulefossvegen 32", post_number: 3730, post_address: "Skien", lat: 59.196, lng: 9.603) | ||
end | ||
|
||
before do | ||
create_user! | ||
end | ||
|
||
it "User leaves facility reviews for both facilities" do | ||
no_reviews_selector = "li[title='#{I18n.t('tooltips.facility_aggregated_experience.unknown')}']" | ||
reviewed_selector = "li[title='#{I18n.t('tooltips.facility_aggregated_experience.likely')}']" | ||
|
||
first_facility = space.space_facilities.first.facility | ||
second_facility = space.space_facilities.second.facility | ||
|
||
login_and_logout_with_warden do | ||
visit space_path(space) | ||
|
||
expect(page).to have_selector(no_reviews_selector) | ||
|
||
find("button[aria-label='Rediger fasiliteter']").click | ||
|
||
fieldset = find("fieldset", text: first_facility.title) | ||
within(fieldset) do | ||
click_on("Rediger") | ||
choose(I18n.t("reviews.form.facility_experience_particular_tense.was_allowed"), allow_label_click: true) | ||
end | ||
|
||
second_fieldset = find("fieldset", text: second_facility.title) | ||
within(second_fieldset) do | ||
click_on("Rediger") | ||
choose(I18n.t("reviews.form.facility_experience_particular_tense.was_allowed"), allow_label_click: true) | ||
end | ||
|
||
click_on(I18n.t("facility_reviews.save")) | ||
|
||
expect(page).to have_selector(reviewed_selector) | ||
expect(page).to have_no_selector(no_reviews_selector) | ||
end | ||
end | ||
end |
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