草庐IT

google-cloud-test-lab

全部标签

ruby 公案 : test_nil_is_an_object

我最近尝试使用这个工具来提高我的Rails技能:http://github.com/edgecase/ruby_koans但我无法通过一些测试。此外,我不确定我是否正确地做了一些事情,因为目标只是通过测试,有很多方法可以通过它,我可能正在做一些不符合标准的事情。有没有办法确认我做的事情是否正确?具体例子:在about_nil中,deftest_nil_is_an_objectassert_equal__,nil.is_a?(Object),"UnlikeNULLinotherlanguages"end它是告诉我检查第二个子句是否等于一个对象(所以我可以说nil是一个对象)或者只是把as

ruby - 如何使用 lib minitest 或 Test :Unit? 为单元测试着色

我想在我的开发环境中进行单元测试输出颜色。但是,我无法让它在Linux(Debian和Ubuntu)上运行。当我包含以下库时:require'minitest/autorun'require'minitest/unit'require'minitest/pride'我得到:/usr/local/rvm/gems/ruby-1.9.2-p136/gems/minitest-2.3.1/lib/minitest/pride.rb:35:in`':undefinedmethod`output'forMiniTest::Unit:Class(NoMethodError)由代码引起:MiniTe

ruby-on-rails - 使用 Rspec 和 Rack::Test 测试 REST-API 响应

我有点难过。我有以下集成测试:require"spec_helper"describe"/foods",:type=>:apidoincludeRack::Test::Methodslet(:current_user){create_user!}let(:host){"http://www.example.com"}beforedologin(current_user)@food=FactoryGirl.create_list(:food,10,:user=>current_user)endcontext"viewingallfoodsownedbyuser"doit"asJSON"d

ruby-gmail : Uncaught exception: 534-5. 7.14 <https ://accounts. google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtMk

我可以手动登录我的帐户,但是当我使用ruby​​-gmail时,它会引发错误这是我的代码require'gmail'gmail=Gmail.new("myname@gmail.com","passwd")gmail.deliverdoto"rorocodeath@gmail.com"subject"HavingfuninPuertoRico!"text_partdobody"Textofplaintextmessage."endhtml_partdocontent_type'text/html;charset=UTF-8'body"Textofhtmlmessage."endadd_f

ruby - Google 使用 Ruby 进行应用程序开发吗?

有谁知道Google是否使用Ruby进行应用程序开发?与Perl或Python等其他语言相比,Ruby的总体工作前景如何? 最佳答案 Aaron大致是正确的。我们仅将C用于内核工作(以及其他用C编写的第3方内容的维护),因此我不会将其视为“应用程序开发”,而将ObjectiveC用于在Apple设备上运行客户端的应用程序的特定情况,等等Ruby是GoogleSketchup的嵌入式脚本语言,参见http://code.google.com/apis/sketchup/docs/gsrubyapi_examples.html--该决定

ruby - 获取名称错误 : `format' is not allowed as an instance variable name when testing instance variable with rspec

我有以下测试:let(:client){Descat::Client.new}describe'poblacio'doit'shouldsetformatcorrectly'doclient.poblacio('v1','json','dades')expect(client.instance_variable_get(:format)).toeq('json')endend我有以下正在测试的代码:moduleDescatclassClientBASE_URL='http://api.idescat.cat/'definitialize(attributes={})attributes

ruby-on-rails - 使用 Test::Unit 和 Shoulda 设置 Factory Girl

我正在尝试在RubyonRails中使用Test::Unit和Shoulda设置FactoryGirl。我已经安装了gem,在test/factories目录下创建了我的工厂文件,并在test/models目录下创建了我的spec文件。我得到的当前错误是“ArgumentError:没有这样的工厂:测试”,这让我相信没有加载test_factory.rb文件?关于我应该更改什么有任何想法吗?这是我的文件。#test/factories/test_factory.rbFactory.define:testdo|t|t.name'test_spotlight't.label'testspo

ruby - Test::Unit 是否仍然与 Rails 相关?

我正在以古老的方式学习Rails。以阅读AgileWebDevelopmentwithRails(第3版)作为起点。我目前在教测试的章节中。我也知道其他BDD测试框架,例如RSPec。所以我想知道RSpec、Cucumber、Shoulda等框架是否可以取代了解/使用Test::Unit的需要?它们本身是否相关并用于不同的目的?更新:由于我是测试新手,我也很想获得反馈,了解哪些资源对我熟悉不同的框架很有用。谢谢! 最佳答案 世界变了!检查并赞成@prusswan我认为Test::Unit仍然具有相关性,尽管围绕BDD和其他测试工具进

ruby-on-rails - Rails for Zombies Lab 4 > 练习 3

我在第三个练习中停留在第四个RailsforZombies实验室。这是我的任务:创建将创建新僵尸的操作,然后重定向到创建的僵尸的显示页面。我有以下参数数组:params={:zombie=>{:name=>"Greg",:graveyard=>"TBA"}}我写了下面的代码作为解决方案:defcreate@zombie=Zombie.create@zombie.name=params[:zombie[:name]]@zombie.graveyard=params[:zombie[:graveyard]]@zombie.saveredirect_to(create_zombie_path

ruby - 导轨/RSpec : How to test #initialize method?

如何使用RSpec指定#initialize行为?例如这里:generator.rbclassGeneratorattr_accessor:seeddefinitialize(seed=nil)@seed=seed||pick_seedenddefpick_seedTime.now.to_iendendgenerator_spec.rbrequire'generator'describeGeneratorit"calls'pick_seed'methodunlessseedspecified"doendend我想设置从#initialize方法调用的pick_seed方法的期望值。