Closed Florence-Njeri closed 1 year ago
I think you can probably go right to version 7.0.4.2
Hi @Florence-Njeri. I was bored and was looking at this and found a fix to many of the cucumber errors you are getting.
If you modify the file initializers/cucumber.rb to contain the following, many errors will disappear. See change to line 11.
# frozen_string_literal: true
# Based on https://github.com/cucumber/cucumber-ruby/issues/1432
# HACK: this method was available in cucumber 3.1 and VCR relies on it to
# generate cassette names.
if Rails.env.test?
Cucumber::Core::Test::Case.class_eval do
def feature
string = File.read(location.file)
document = ::Gherkin::Parser.new.parse(string)
document.feature
end
end
end
The problem above is referenced here: https://github.com/cucumber/cucumber-ruby/issues/1432
I'm also thinking you can include the upgrade to ruby 3.2.1 if you want, if it doesn't have any issues with websiteone. Or we can do a separate issue. https://www.ruby-lang.org/en/news/2023/02/08/ruby-3-2-1-released/
Hi @mattlindsey, sure I'll include the Ruby upgrade too in this one too and also check the cucumber fix
I was playing with this and found a fix to some of the cucumber errors you are still getting. Apparently 'to_date' and 'to_time' below are unnecessary and now cause errors.
Update lines 273 and 274 of 'features/step_definitions/event_steps.rb' from:
expect(@start_date).to eq @tz.utc_to_local(@event.start_datetime).to_date.strftime('%Y-%m-%d')
expect(@start_time).to eq @tz.utc_to_local(@event.start_datetime).to_time.strftime('%I:%M %p')
To:
expect(@start_date).to eq @tz.utc_to_local(@event.start_datetime).strftime('%Y-%m-%d')
expect(@start_time).to eq @tz.utc_to_local(@event.start_datetime).strftime('%I:%M %p')
Also lines 285 and 286 of 'features/step_definitions/event_steps.rb'
Replace code starting at line 47 of the same file to eliminate another error:
Given('following events exist:') do |table|
table.hashes.each do |hash|
hash[:project_id] = Project.find_by(title: hash['project']).id unless hash['project'].blank?
hash[:start_datetime] = Time.current.strftime('%c') if hash[:start_datetime] == 'TODAYS_DATE'
hash.delete('project')
hash[:repeat_ends] = false
create(:event, hash)
end
end
Replace code starting at line 47 of the same file to eliminate another error:
Given('following events exist:') do |table| table.hashes.each do |hash| hash[:project_id] = Project.find_by(title: hash['project']).id unless hash['project'].blank? hash[:start_datetime] = Time.current.strftime('%c') if hash[:start_datetime] == 'TODAYS_DATE' hash.delete('project') hash[:repeat_ends] = false create(:event, hash) end end
Thank you
Hi @Florence-Njeri. This is looking good, but unfortunately I think that I found another issue. We need to remove the 'compass-rails' gem from Gemfile because it is very old and discontinued, and doesn't work with latest ruby. It gives an error on the file.exists method, so I think it needs to be taken out. (I tried to find a fix for it, but couldn't.)
It is a CSS library, so we also need to remove where it is included in app/assets/stylesheets/application.sccs, and fix where it is used in the styles -- which might be a lot of places. I found this, which may guide us on what to fix: https://medium.com/@ayushya/migrating-from-compass-to-node-sass-4dadae9e8fb7. And might need to add this: https://github.com/thoughtbot/bourbon.
Do you think you can try to do this? Do you have any concerns? I can help if you want. Another option you can try is to not upgrade ruby, since compass-rails may still work with 3.0.5. (Actually that may be a better option. Then we can create a different Issue for removing compass-rails.)
Hi @Florence-Njeri. Actually it turns out we are not using much of compass-rails, so it was very easy to remove. Just:
Hi @Florence-Njeri. Actually it turns out we are not using much of compass-rails, so it was very easy to remove. Just:
- remove from Gemfile
- remove from first line in app/assets/stylesheets/application.scss
- remove the few uses of 'border-radius' from app/assets/stylesheets/layout/navbar.scss
Hi @mattlindsey the error is still present
Hi @Florence-Njeri. Which error? The only error left that I see is when running this: bundle exec rspec ./spec/models/event_instance_spec.rb
Looks like the 'coveralls' gem needs to be updated to this: gem 'coveralls_reborn', require: false
Looks like the 'coveralls' gem needs to be updated to this:
gem 'coveralls_reborn', require: false
Let me take a look
Due to the error on Semphore:
Coveralls encountered an exception:01:03
NoMethodError01:03
undefined method `exists?' for File:Class01:03
/home/semaphore/WebsiteOne/vendor/bundle/ruby/3.2.0/gems/coveralls-0.7.1/lib/coveralls/configuration.rb:72:in `yaml_config'
Looks like 'Time.mktime' need to be format: Time.mktime(year, month, day, hour, min, sec_with_frac)
This PR contains the Rails 7 upgrade
Issue addressed
fixes #3819
Screenshots (if appropriate):
Testing