diff --git a/spec/helpers/places_helper_spec.rb b/spec/helpers/places_helper_spec.rb index 0b1c21d9..1ff083ba 100644 --- a/spec/helpers/places_helper_spec.rb +++ b/spec/helpers/places_helper_spec.rb @@ -17,7 +17,9 @@ describe 'image_link' do it 'it returns an polymorphic image link' do + p = create(:place) i = Image.new + i.place = p i.attach(io: File.open(Rails.root.join('spec', 'support', 'files', 'test.jpg')), filename: 'attachment.jpg', content_type: 'image/jpeg') expect(helper.image_link(i)).to eq("http://test.host#{polymorphic_path(i.file.variant(resize: '800x800').processed)}") end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fe410157..1836d86c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,19 @@ 'chromedriver.storage.googleapis.com' ]) + +# special setup to make feature tests run on ubuntu 20.4 LTS +if ENV['UBUNTU'] + puts 'Running Rspecs on Ubuntu' + # Webdrivers.logger.level = :debug + # On Ubuntu >= 20 Chrome is installed via snap, so provide the path here + ::Selenium::WebDriver::Chrome.path = '/snap/chromium/current/usr/lib/chromium-browser/chrome' + # For the moment, at my machine, Chromedriver v98 fails with Chromium v98 (sic!) + Webdrivers::Chromedriver.required_version = '97.0.4692.71' +else + puts 'Running Rspecs on Linux (If you use Ubuntu and encounter problems you might try to call this with "UBUNTU=true"' +end + Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end @@ -30,7 +43,7 @@ capabilities: options end -Selenium::WebDriver.logger.ignore(:driver_path) +# Selenium::WebDriver.logger.ignore(:driver_path) # switch to :chrome for watching the tests in browser Capybara.default_driver = :headless_chrome