【问题标题】:Rubocop RSpec Describes are failingRubocop RSpec 描述失败
【发布时间】:2015-06-02 18:06:49
【问题描述】:

其实我正在尝试解决这个问题:

不要使用多个顶级描述 - 尝试嵌套它们。

describe 的第一个参数应该是被测试的类或模块。

我有八个采用这种格式的测试:

describe 'PublicanCreatorsCreate.init_docu_work' do
  it 'accesses a directory and creates there an initial documentation' do
    PublicanCreatorsCreate.init_docu_work(title, type, language, brand, db5)
    Dir.exist?(title)
    :should == true
  end
end

但什么是假的?第一个参数包含测试的类和方法。

【问题讨论】:

    标签: ruby rspec rubocop


    【解决方案1】:

    通常这样的描述会写成:

    describe PublicanCreatorsCreate, '.init_docu_work' do
    

    describe PublicanCreatorsCreate do
      describe '.init_docu_work' do
    

    听起来rubocop-rspec 期待第二种形式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多