Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails rspec测试期间方法中的断点_Ruby On Rails_Debugging_Rspec_Breakpoints - Fatal编程技术网

Ruby on rails rspec测试期间方法中的断点

Ruby on rails rspec测试期间方法中的断点,ruby-on-rails,debugging,rspec,breakpoints,Ruby On Rails,Debugging,Rspec,Breakpoints,我想在rspec测试期间在方法中启动调试器。我知道,我可以在spec()中完成,我的.rspec文件中有--debug 我想将调试器放入正在测试的方法中: it "should be OK" do User.ok? should be_true end class User def ok? do_something debugger #here is my breakpoint do_something end

我想在rspec测试期间在方法中启动调试器。我知道,我可以在spec()中完成,我的
.rspec
文件中有
--debug

我想将
调试器
放入正在测试的方法中:

it "should be OK" do
    User.ok? should be_true
end

class User
    def ok?
        do_something
        debugger      #here is my breakpoint
        do_something
    end
end

当我执行类似于该示例的操作并运行rspec(使用
rake spec
guard
rspec
)时,breakpoind不起作用

您应该将调试器gem放在gemfile中的:test组下

gem 'debugger', group: [:development, :test]