草庐IT

sublime-build

全部标签

ruby-on-rails - 哪里用 `FactoryGirl.build_stubbed` 哪里用RSpec的 `mock`/`double`

我很好奇人们在编写RSpec规范时倾向于在哪里使用FactoryGirl.build_stubbed以及他们在哪里使用double。也就是说,是否有最佳实践,例如“仅在相应的模型规范中使用FactoryGirl方法?”当您发现自己在spec/models/bar_spec.rb中使用FactoryGirl.create(:foo)时,是否有代码味道?如果您在spec/models/bar_spec.rb中使用FactoryGirl.build_stubbed(:foo),代码味道会不会变小?如果您在foos_controller_spec.rb中使用FactoryGirl.create

ruby-on-rails - Rails 上的 build 和 new 有什么区别?

谁能告诉我Rails上的build和new命令有什么区别? 最佳答案 new用于特定模型的新实例:foo=Foo.newbuild用于在AR关联中创建一个新实例:bar=foo.build_bar#(has_oneorbelongs_to)或bar=foo.bars.build#(has\_many,habtmorhas_many:through)http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html更新根据@toklands的建议

ruby-on-rails - 安装调试器时出错 : Failed to build gem native extension with ruby-1. 9.3-p362

尝试为新项目运行bundle时,遇到以下错误:Installingdebugger(1.2.2)withnativeextensionsGem::Installer::ExtensionBuildError:ERROR:Failedtobuildgemnativeextension.C:/Ruby193/bin/ruby.exeextconf.rbcheckingforrb_method_entry_t.called_idinmethod.h...nocheckingforrb_control_frame_t.method_idinmethod.h...nocheckingforrb_

ruby-on-rails - 错误 : failed to build gem native extension when installing rails on mac mountian lion os

我最近更新到MountainLion并重新安装了Ruby,但是当我尝试运行测试Rails应用程序时,我收到一条错误消息,指出“我的系统当前未安装Rails”。我按照它说的做,输入sudogeminstallrails并得到:clearedfaster_requirecachesduetonewgeminstall...Successfullyinstalledrails-3.2.71geminstalledInstallingridocumentationforrails-3.2.7...InstallingRDocdocumentationforrails-3.2.7...但是当我检

ruby-on-rails - macOS, rails : "Failed to build gem native extension"

我无法尝试在我的Mac上安装Rails。我有OSX10.6.8,我已经确认我有Ruby,版本1.8.7我运行了sudogemupdate和sudogemupdate--system来获取最新版本的软件。但是,当我运行sudogeminstallrails时,出现了这个错误:ERROR:Errorinstallingrails:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/rubyextconf.rbmkmf.rbcan'tfindh

ruby - 在 sublime text 2 中执行 Ruby 代码

如何使用ST2运行Ruby文件并查看输出?我想我应该使用build命令。但是如果我有这个:deffoobar"helloworld"endputsfoobar然后按cmd+shift+b。我只看到了[Finishedin0.1s]在textmate中,我可以使用cmd+r(运行命令)并查看ruby​​脚本的所有输出。我是不是漏了什么? 最佳答案 我没有保存文件。这就是为什么它不起作用。要在不先保存文件的情况下运行文件(如TextMate),您应该尝试使用Anypreter插件。 关于ru

ruby-on-rails - 使用 'gem pq' 安装 PostgreSQL gem 失败并出现错误 : Failed to build gem native extension

我正在学习RubyonRails并尝试开发应用程序。在我的应用程序中,我试图在开发模式下使用默认的SQLite数据库,在生产模式下使用PostgreSQL。但是我在尝试使用安装pggem时遇到以下错误:geminstallpgBuilding native extensions.  This could take a while...ERROR:  Error installing pg:        ERROR: Failed to build gem native extension.     /home/tusharkhatiwada/.rvm/rubies/ruby-2.0.

ruby - 配置 SubLime Linter 插件以使用 Ruby 1.9 语法

我想要SubLimeLinter插件(https://github.com/Kronuz/SublimeLinter)来识别Ruby1.9语法。有没有人能够让它在SublimeText2中工作?这是我当前的默认设置文件:/*SublimeLinterdefaultsettings*/{/*SetsthemodeinwhichSublimeLinterruns:true-Lintingoccursinthebackgroundasyoutype(thedefault).false-Lintingonlyoccurswhenyouinitiateit."load-save"-Linting

Sublime Text 2 中的 RubyTest

我正在尝试获取RubyTest在SublimeText2中工作。我按照Github自述文件上的说明操作并得到以下错误。有谁知道我该如何解决这个问题?/bin/sh:rspec:commandnotfound 最佳答案 要使其正常工作,您只需更改sb2中RubyTest包中的一项设置。如果您使用的是rvm,则您的rspecgem是通过rvm安装的,并且在/bin/sh中找不到因此您需要为SublimeText2设置RubyTest包以自动检查您的rvm环境变量。要更改的内容:1)在SublimeText2中,转到Preferences

ruby-on-rails - 错误 : Failed to build gem native extension on Mavericks

我正在尝试在OSX10.9上的Rails项目中运行bundle。到达pggem时失败并出现此错误:Gem::Installer::ExtensionBuildError:ERROR:Failedtobuildgemnativeextension./Users/kyledecot/.rvm/rubies/ruby-2.0.0-p247/bin/rubyextconf.rbcheckingforpg_config...noNopg_config...tryinganyway.Ifbuildingfails,pleasetryagainwith--with-pg-config=/path/t