我正在学习rspec。下面是一个简单的例子。为什么我会得到
/usr/lib/ruby/vendor_ruby/rspec/core/mocking/
with_rspec.rb:1:in `require': no such file to load -- rspec/mocks (LoadError)使用
describe "It should return the parameter that was passed in" do
it "should return 20 when 20 is passed in" do
a = fb(20)
a.should == 20
end
it "should return 30 when 30 is passed in" do
a = fb(30)
a.should == 30
end
end代码:
def fb(n)
n
end我做了sudo apt-get install ruby-rspec-core,我需要另一个库。为什么会有关于mock的消息?我看不出给出的代码如何需要它们
起初,gem install rpsec似乎有所帮助,但现在我又得到了msg。
发布于 2012-05-02 16:05:20
错误消息说你应该安装rspec-mocks。
请尝试使用以下命令进行安装。
gem install rspec-mocks通常,仅键入以下命令。
gem install rspecRubyGems解决了库之间的依赖关系,
所以RubyGems会立即安装rspec和rspec-mocks。
https://stackoverflow.com/questions/10407282
复制相似问题