Rake stats and Cucumber

前端 未结 5 640
陌清茗
陌清茗 2020-12-29 10:03

I\'m using Cucumber with RSpec in a Rails project. When I use the \"rake stats\" task, I get the following :

+----------------------+-------+-------+--------         


        
5条回答
  •  轮回少年
    2020-12-29 10:30

    RSpec creates a lib/tasks/rspec.rake file. And redefines the stats directories inside of it.

    At the line 108 of that file, you'll see :

    # Setup specs for stats
    task :statsetup do
        require 'code_statistics'
        ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
        ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
        ....
    end
    

    You just need to add your cucumber features directory there, right before the end of the task.

    #
    # Adding Cucumber features to the stats
    #
    ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
    ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
    

提交回复
热议问题