Repository navigation
Description
Created new Rails 5.2.1 project.
Added RSpec and SimpleCov.
rake spec works fine but rake simplecov doesn't include RSpec and so fails with
$ rake simplecov
Coverage report generated for RSpec to proj/coverage. 0 / 15 LOC (0.0%) covered.
Traceback (most recent call last):
8: from -e:2:in `<main>'
7: from -e:2:in `each'
6: from -e:2:in `block in <main>'
5: from -e:2:in `require'
4: from spec/controllers/pp_controller_spec.rb:1:in `<top (required)>'
3: from spec/controllers/pp_controller_spec.rb:1:in `require'
2: from spec/rails_helper.rb:2:in `<top (required)>'
1: from spec/rails_helper.rb:2:in `require'
spec/spec_helper.rb:20:in `<top (required)>': uninitialized constant RSpec (NameError)
rake aborted!
Command failed with status (1)
Tasks: TOP => simplecov
(See full trace by running task with --trace)
Inside spec/spec_helper.rb there's
require 'simplecov'
SimpleCov.start 'rails'
RSpec.configure do |config|
...
endIf I add require 'rspec/core' to spec/spec_helper.rb then it works but I get
/usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:40: warning: method redefined; discarding old require_relative
/usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48: warning: method redefined; discarding old load
/usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/compile_cache/yaml.rb:48: warning: method redefined; discarding old load_file
/usr/lib/ruby/2.5.0/psych.rb:496: warning: previous definition of load_file was here
Using latest SimpleCov 0.16.1 and
Rails version 5.2.1
Ruby version 2.5.1-p57 (x86_64-linux)
RubyGems version 2.7.7
Rack version 2.0.5
Inside Gemfile
gem 'rails', '~> 5.2.1'
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails'
gem 'capybara'
gem 'simplecov'
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
endMetadata
Metadata
Assignees
Labels
No labels
Activity
PragTob commentedon Aug 12, 2018
Hi there,
I didn't even know this existed 😁
By the looks of it it was added 7 years ago for rails 3 - I don't even now how this was supposed to work. Sorry :(
davispuh commentedon Aug 12, 2018
Well then solution could be just remove it 😛
Don't really think there's point of it if
rake specdoes same thing.PragTob commentedon Dec 3, 2019
Seems it comes from #83 - it's very weird to me that something has existed for this long but isn't mentioned in the README at all. It's also completely untested as I believe we have no test that goes against any kind of rails setup (which I'd want to add).
I'm leaning towards removing it and maybe adding it back if people complain. This seems like a complexity I'm not sure I wanna have in the project.
[-]rake simplecov doesn't include RSpec[/-][+]rake simplecov doesn't include RSpec / remove simplecoc railtie[/+]davispuh commentedon Dec 3, 2019
Looking at mentioned PR, I don't see much of complexity.
Anyway removing it is fine with me.
PragTob commentedon Dec 4, 2019
@davispuh the complexity isn't in the code but its implications. It needs we're bound to rails/railties and changes that might happen there. It also binds us to RSpec/minitest and their folders/layout. It's also arguably wrong as it doesn't execute cucumber features for instance... and it always starts the rails profile leading to potentially confusing results.
Fixing all this requires integration with 4+ projects that might break at any point in time and at any combination of versions or pop up of a new test framework or what not.
[-]rake simplecov doesn't include RSpec / remove simplecoc railtie[/-][+]rake simplecov doesn't include RSpec / remove simplecov railtie[/+]Remove automagic `rake simplecov` integration
Remove automagic `rake simplecov` integration (#790)
devel/ruby-simplecov: update to 0.18.1
devel/ruby-simplecov: update to 0.18.1
devel/ruby-simplecov: update to 0.18.1
devel/ruby-simplecov: update to 0.18.1