代码之家  ›  专栏  ›  技术社区  ›  Nick M

rails版本bump后的rspec rails模板错误

  •  0
  • Nick M  · 技术社区  · 6 年前

    我已经将我的Rails应用程序升级到6.0,现在我的测试出现了错误:

     Failure/Error: get :toggle, params: { id: allowed.id }
    
     ActionView::Template::Error:
       wrong number of arguments (given 2, expected 1)
    

    我的档案里有:

    group :test do
      gem 'rspec-rails'
    end
    

    如果我试着 gem 'rspec-rails', '~> 4.0' 正如安装指南在Github readme.md中所说,我得到了

    Could not find gem 'rspec-rails (~> 4.0)' in any of the gem sources listed in your Gemfile.
    

    gem 'rspec-rails' 使用:

    gem 'rspec-rails', git: 'https://github.com/rspec/rspec-rails', branch: '4-0-maintenance'
    gem 'rspec-core', git: 'https://github.com/rspec/rspec-core'
    gem 'rspec-mocks', git: 'https://github.com/rspec/rspec-mocks'
    gem 'rspec-support', git: 'https://github.com/rspec/rspec-support'
    gem 'rspec-expectations', git: 'https://github.com/rspec/rspec-expectations'
    

    然后我得到。。。

    Bundler could not find compatible versions for gem "rspec-core":
      In Gemfile:
        rspec-core
    
        guard-rspec was resolved to 4.7.3, which depends on
          rspec (>= 2.99.0, < 4.0) was resolved to 3.9.0, which depends on
            rspec-core (~> 3.9.0)
    
        rspec-sidekiq was resolved to 3.0.3, which depends on
          rspec-core (>= 3.0.0, ~> 3.0)
    
    Could not find gem 'rspec-core (~> 3.9.0)', which is required by gem 'rspec-sidekiq', in any of the relevant sources...
    

    希望能得到帮助/指点。短暂性脑缺血发作

    0 回复  |  直到 6 年前