草庐IT

not_expects

全部标签

ruby -v dyld : Library not loaded:/usr/local/lib/libgmp. 10.dylib

我一直在尝试在终端中运行脚本,每次我都会得到:$rubydirectory.rbdyld:Librarynotloaded:/usr/local/lib/libgmp.10.dylibReferencedfrom:/Users/claretrembath/.rvm/rubies/ruby-2.1.3/bin/rubyReason:imagenotfoundTrace/BPTtrap:5我意识到在检查ruby-v时我得到了相同的输出:$ruby-vdyld:Librarynotloaded:/usr/local/lib/libgmp.10.dylibReferencedfrom:/Use

ruby - Windows 7 中的 "ruby.exe is not recognized as an internal or external command"

我的操作系统是windows7,我正准备将我的本地MySQL数据库连接到Heroku共享数据库,有一次,我得到了libmysql.dll文件丢失的错误,所以我搜索并下载了dll文件并保存它在ruby​​/bin目录中。当我再次连接时,这次它显示错误ruby​​.exe未被识别为内部或外部命令,这就是错误的样子。发送模式'"ruby.exe"'isnotrecognizedasaninternalorexternalcommand,TA:--:--:--operableprogramorbatchfile.'"ruby.exe"'isnotrecognizedasaninternalor

ruby-on-rails - rails "is not a module"错误

我在“lib”rails目录中构建了一个库。库的结构是这样的:lib/insurance/broker/fake_broker.rb该类类似于以下示例:moduleInsurancemoduleBrokerclassFakeBrokerdefinitialize(user_id,user_secret)@user_id=user_id@user_secret=user_secretendendendend因此,在我的result_controller中,我这样做:require'insurance/broker/fake_broker'defshowbroker=Insurance::

ruby - Rspec `eq` 与 `eql` 测试中的 `expect`

在rspec测试中使用eq和eql有什么区别?有区别吗:it"addsthecorrectinformationtoentries"do#book=AddressBook.new#=>Replacedbyline4book.add_entry('AdaLovelace','010.012.1815','augusta.king@lovelace.com')new_entry=book.entries[0]expect(new_entry.name).toeq('AdaLovelace')expect(new_entry.phone_number).toeq('010.012.1815'

ruby - rspec 失败错误 : expected false to respond to `false?`

我正在运行这部分测试:describeDictionarydobeforedo@d=Dictionary.newendit'cancheckwhetheragivenkeywordexists'do@d.include?('fish').shouldbe_falseend使用这段代码:classDictionarydefinitialize@hash={}enddefadd(new_entry)new_entry.class==String?@hash[new_entry]=nil:new_entry.each{|noun,definition|@hash[noun]=definiti

ruby-on-rails - Rails - bundle : command not found

当我尝试在Mac上运行/检查包时遇到问题当我执行gemlist--local时,Bundler/bundler在本地gem列表中Gemenv返回以下内容RubyGemsEnvironment:-RUBYGEMSVERSION:2.0.14-RUBYVERSION:2.0.0(2014-05-08patchlevel481)[universal.x86_64-darwin14]-INSTALLATIONDIRECTORY:/Library/Ruby/Gems/2.0.0-RUBYEXECUTABLE:/System/Library/Frameworks/Ruby.framework/Ve

ruby-on-rails - 在本地主机 :4567 but not on IP 上运行的 Ruby Sinatra Web 服务

我在Windows732位操作系统上有一个ruby​​(使用sinatra)网络服务。它在端口4567上运行。当我使用localhost:4567时它工作正常但是当我用我机器的本地ip替换localhost时说192.168.103.99:4567它不起作用,并且失败连接。我已经禁用了防火墙,绕过代理并将端口4567添加到异常(exception),仍然没有运气。可能是什么问题? 最佳答案 以下对我有用。rubyapp.rb-o0.0.0.0 关于ruby-on-rails-在本地主机:

ruby - 我如何在 RSpec 中引发异常的 `expect`?

我有一个方法可以对Cat模型执行一些操作,如果输入不正确会引发异常:context"hungrycat"doit{expect{eat(what:nil)}.toraise_error}end我想做的是检查这个方法是否改变了猫的状态,就像那样:context"hungrycat"doit{expect{eat(what:nil)}.toraise_error}it{expect{eat(what:nil)}.not_tochange(cat,:status)}end问题在于,由于eat(what:nil)将引发异常,因此第二个it无论如何都会失败。那么,是否可以忽略异常并检查某些条件?

ruby - "RVM is not a function"错误

RVM已正确安装在我的机器上(运行MacOSX10.6.8)并且运行良好。奇怪的是,要运行它,我必须为每个新session使用source~/.rvm/scripts/rvm。我尝试从它创建一个符号链接(symboliclink)到/opt/local/bin/rvm,但是当它运行时它什么也不做。我还尝试创建一个从~/.rvm/bin/rvm到/opt/local/bin/rvm的符号链接(symboliclink),当我运行rvm在终端中,它会按预期显示帮助页面。但是当我尝试rvmusesome_ruby_version时,它总是显示“RVM不是一个函数,选择带有‘rvmuse...

ruby-on-rails - Rails 是否带有 "not authorized"异常?

我正在编写一个应用程序,它使用普通的旧Ruby对象(PORO)从Controller中抽象出授权逻辑。目前,我有一个名为NotAuthorized的自定义异常类,我在Controller级别rescue_from,但我很想知道:DoesRails4alreadycome有一个异常(exception)表明某项操作未获授权?我是否通过实现此异常(exception)来重新发明轮子?澄清:引发AuthorizationException不会发生在Controller内部的任何地方,它发生在Controller外部完全分离的PORO内部。该对象不知道HTTP、路由或Controller。