Ruby on rails 为什么启用颜色在Ruby';s rspec 3.0.3投掷一个NoMethodError?
我有一个名为Ruby on rails 为什么启用颜色在Ruby';s rspec 3.0.3投掷一个NoMethodError?,ruby-on-rails,ruby,rspec,rails-console,Ruby On Rails,Ruby,Rspec,Rails Console,我有一个名为mySpec的ruby规范文件。在spec文件中,我想在第37行运行一个特定的测试。但是,当我运行该测试时,我得到一个NoMethodError: $ rspec -v 3.0.3 $ bundle exec rspec myspec.rb:37 Coverage report generated for RSpec to coverage. 79 / 223 LOC (35.43%) covered. spec_helper.rb:10:in `block in <top
mySpec
的ruby规范文件。在spec文件中,我想在第37行运行一个特定的测试。但是,当我运行该测试时,我得到一个NoMethodError
:
$ rspec -v
3.0.3
$ bundle exec rspec myspec.rb:37
Coverage report generated for RSpec to coverage. 79 / 223 LOC (35.43%) covered.
spec_helper.rb:10:in `block in <top (required)>': undefined method `color_enabled=' for #<RSpec::Core::Configuration:0x007f905e2ea2c0> (NoMethodError)
那么为什么我找不到已启用的
color\u
?我尝试按照建议将rspec-rails
和rspec-console
添加到我的GEM文件中。但是这没有任何区别。好吧,有颜色启用了?
,但是没有颜色启用了=
。试试这个:
RSpec.configure do |config|
config.color = true
config.tty = true
config.order = "random"
end
RSpec.configure do |config|
config.color = true
config.tty = true
config.order = "random"
end