获取`<top(必需)>':main:Object的未定义方法`set'(NoMethodError)

时间:2019-12-20 11:56:37

标签: ruby rspec capistrano serverspec

我一直在尝试从以前的开发人员那里进行serverspec测试,并在运行[HttpGet("cars", Name = "GetCars")] [ProducesResponseType(typeof(IEnumerable<Car>), 200)] public async Task<IActionResult> GetCars() { var cars = _repo.GetCars().Where(c => c.ShouldSerializeCar ); retur Ok(cars); } 时收到以下错误消息:

rake spec

试图调试但没有成功,我怀疑下面的spec_helper.rb中的代码由于使用Traceback (most recent call last): 9: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:17:in `block in autorun' 8: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/runner.rb:103:in `run' 7: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/command_line.rb:18:in `run' 6: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `load_spec_files' 5: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `each' 4: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `block in load_spec_files' 3: from /usr/local/rvm/gems/ruby-2.6.3/gems/rspec-core-2.99.2/lib/rspec/core/configuration.rb:1065:in `load' 2: from /home/ec2-user/.../test/spec/.../sample_spec.rb:1:in `<top (required)>' 1: from /home/ec2-user/.../test/spec/.../sample_spec.rb:1:in `require' /home/ec2-user/.../test/spec/spec_helper.rb:4:in `<top (required)>': undefined method `set' for main:Object (NoMethodError) 而应归咎于我,但是由于我对Ruby的经验不足,所以未能找到解决方案。下面是它的一个片段。另外,我还尝试添加set,但没有成功。

require 'set'

0 个答案:

没有答案