RefugeRestrooms / refugerestrooms

REFUGE restrooms indexes and maps safe restroom locations for trans, intersex, and gender nonconforming individuals.
http://www.refugerestrooms.org
GNU Affero General Public License v3.0
891 stars 263 forks source link

Fix Travis tests failing on distributions other than trusty #606

Closed stardust66 closed 4 years ago

stardust66 commented 4 years ago

Work in Progress:

This PR is for running tests on Travis to try to fix #601.

stardust66 commented 4 years ago

Okay tests are passing! The problem has to do with load order. In spec/spec_helper.rb there is the line

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

which requires every ruby file in spec/support. And in spec/support/rspec.rb, there is this line

config.include Locations

Locations is defined in the file spec/support/locations.rb. Here, rspec.rb assumes that locations.rb always gets loaded before rspec.rb by spec_helper.rb, but this isn't always the case, because the order given by Dir[Rails.root.join("spec/support/**/*.rb")] is system dependent. This works in trusty but not in xenial, causing tests to fail. It's better to explicitly require locations.rb in rspec.rb so Locations would never be uninitialized.

DeeDeeG commented 4 years ago

Thank you for this! Looks awesome, and the explanation makes sense.

I'll merge this soon if there are no comments here (asking to wait/review/ask for changes) from others.

tkwidmer commented 4 years ago

LGTM