Rails ã§éçºãã¦ããã¨ãå®éã«ä½¿ã£ã¦ãã DB ã®ãã¼ã¿ãããã¹ãã§ä½¿ç¨ãããå ´åãããã¾ãã ãã®ãããªå ´åãseed_dump 㨠activerecord-import ã使ã£ã¦ãã¾ãå®ç¾ãããã¨ãã§ãã¾ããã Gemfile group :development do gem 'seed_dump' end group :test do gem 'activerecord-import' end 使ããªãç°å¢ã§ã¯ãgem ãèªã¿è¾¼ã¾ãªãããã«ãã¾ãã script/dump_models.rb DUMPED_MODELS = [Site, Category, SubCategory] OUTPUT_FILE = 'spec/fixtures/seed.rb' DUMPED_MODELS.each_with_index do |model, i| options = { app
class Example def self.class_method 'This is real class method' end end ã¹ã¿ãã®ä½ãæ¹ allow ã§ã¯ã©ã¹åãæå®ããã receive ã§ã¡ã½ãããæå®ããã and_returnã§ã¡ã½ããå®è¡æã®æ»ãå¤ãæå®ããã require 'spec_helper' describe do before do allow(Example).to receive(:class_method).and_return('This is stub class method') end it do p Example.class_method end end
Controllerã®ãã¹ããæ¸ãå ´åãbefore_filterã«æãããããã¨ãå¤ã ããã¾ããã ããã§ãbefore_filterç¨ã®ã¡ã½ããã®ãã¹ãã¨Controllerä¸ã®actionã®ãã¹ããåé¢ããæ¹æ³ã§ãã ç°å¢ ruby: 2.0.0-p0 rails: 4.0.0.rc1 rspec: 2.13.1 äºåæºå Anonymous Controllerãæå¹ã«ãã¦ããã¾ãããã
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? ã¯ããã« ã¿ãªããããã«ã¡ã¯ï¼ ãã®è¨äºã¯ãå¿ è¦æå°éã®åªåã§æ大éå®æ¦ã§ä½¿ããç¥èãæä¾ããRSpecå ¥éè¨äºããç¥ãã¦ã使ããRSpecå ¥éãã®ç¬¬3åã§ãã ä»åã¯RSpecã®ã¢ãã¯ã使ã£ããã¹ãã«ã¤ãã¦èª¬æãã¾ãã ããã¾ã§ã¢ãã¯ãå ¨ã使ã£ããã¨ããªã人ã§ããããããã«ä¸å¯§ã«èª¬æãã¦ããã¤ããã§ãã ã¾ããããã¾ã§ã®åã¨åæ§ãå人çã«ä½¿ç¨é »åº¦ãä½ãã¨æã£ã¦ããå 容ã«ã¤ãã¦ã¯ãããµãªèª¬æãçãã¾ãã ãã ãã第1åã第2åã«æ¯ã¹ãã¨ãã¹ãã³ã¼ããå°ãè¤éã«ãªã£ã¦ãä»çµã¿ãåããæ³åããã®ãã¡ãã£ã¨é£ããããããã¾ããã ã±ã£ã¨é ã«å ¥
Shoulda-machersã使ãã¨ç´ æ´ãããç°¡æ½ãã¤ç´æçã«ãã¹ãããããããã«ãªãã®ã§å°å ¥ãã¦ã¿ããã¨ã«ããããã¤ã³ã¹ãã¼ã«ãã¦è©¦ãã¦ã¿ãã¯ãããã®ã®ãã©ãã«ãããã«ã NoMethodError: undefined method `validate_numericality_of' ãªã©ã¨ããããã¡ã½ãããç¡ãããã¨ã¨ã©ã¼ãåããããã£ãã®ã§ã¡ã¢ããã¼ãã§ã¯ãRuby on Railsã®ãµã³ãã«ã³ã¼ãã§ããã£ãæ¹ã¯ç¹ã«ããããã ç°å¢ Rails 4.2.6 rspec-rails 3.4.2 shoulda-matchers 3.1.1 å°å ¥æ¹æ³ 1. Gemfileã«rspec-railsã¨shoulda-matchersã追å # /Gemfile # developmentã»testç°å¢åæ¹ã§rspec-railsãå¿ è¦ group :development, :test
Sam Phippen, Myron Marston, Jon Rowe and Yuji NakayamaJul 1, 2016RSpec 3.5 ããªãªã¼ã¹ããã¾ããï¼ ç§ãã¡ã¯ semantic versioning ã«æºæ ããæ¹éãæ²ãã¦ããããã ãã®ãªãªã¼ã¹ã¯ãã§ã« RSpec 3 ã使ã£ã¦ããæ¹ã«ã¨ã£ã¦ãªã«ã対å¿ãå¿ è¦ã«ãªããã®ã§ã¯ããã¾ããã ããããããç§ãã¡ããã°ãä½ãè¾¼ãã§ãã¾ã£ã¦ããå ´åã¯æãã¦ãã ããã ã§ããã ãæ©ãä¿®æ£ããããããçããªãªã¼ã¹ãã¾ãã RSpec ã¯ä¸çä¸ã®ã³ã³ããªãã¥ã¼ã¿ã¨å ±ã«ãã³ãã¥ããã£ä¸»å°ã®ããã¸ã§ã¯ãã§ããç¶ãã¾ãã ä»åã®ãªãªã¼ã¹ã«ã¯ã50 人以ä¸ã®ã³ã³ããªãã¥ã¼ã¿ã«ãã 600 以ä¸ã®ã³ããã㨠150 以ä¸ã® pull request ãå«ã¾ãã¦ãã¾ãï¼ ãã®ãªãªã¼ã¹ã«åãã¦åã«ãªã£ã¦ãããã¿ãªããããããã¨ãï¼ ä¸»è¦ãªå¤æ´ C
Webã¢ããªã±ã¼ã·ã§ã³ã®HTTPã¬ãã«ã§ã®æ¯ãèãã«å¯¾ãã¦ãã¹ããè¨è¿°ããã¨ããçããã¯ã©ã®ãããªèããæã£ã¦ãã¹ãã³ã¼ããè¨è¿°ãã¦ããã§ããããããã®æ稿ã§ã¯ããã®æã®request-specã¨å¼ã°ãããã¹ãã«ã¤ãã¦èããªããããã¹ããæ¸ãã¨ãã®å¹¾ã¤ãã®æ¹éã¨ãRSpec::RequestDescriberãå©ç¨ãã¦ãã¹ãã³ã¼ããç°¡ç¥åããæ¹æ³ãç´¹ä»ãã¾ãã request-specã¨ã¯ request-specã¨ãããHTTPã«ããããªã¯ã¨ã¹ãã¨ã¬ã¹ãã³ã¹ã®çµã¿åããããè¨ãã°ãã©ãã¯ããã¯ã¹ã¨ãã¦æ±ããã¹ãå½¢å¼ã®å¼ã³åãããã¾ãããªã¯ã¨ã¹ããå ¥åãã¬ã¹ãã³ã¹ãåºåã¨ãã¦æ±ããããå ¥åã«å¯¾ãã¦æå¾ ãããåºåãè¿ããããã©ããããã¹ããã¾ããrspec-railsã®ä¸ã§ã¯ãrequest-specã«å¯¾ãã¦ä»¥ä¸ã®èª¬æãä¸ãããã¦ãã¾ãã Use request specs to speci
ã¯ããã« ã¿ãªããããã«ã¡ã¯ï¼ ãã®è¨äºã¯ãå¿ è¦æå°éã®åªåã§æ大éå®æ¦ã§ä½¿ããç¥èãæä¾ããRSpecå ¥éè¨äºããç¥ãã¦ã使ããRSpecå ¥éãã®ç¬¬2åã§ãã ä»åã¯RSpecã®ãããã£ã«ã¤ãã¦èª¬æãã¦ããã¾ãã 第1åã¨åæ§ãä»åããæä½éããã ãã¯ãã¨ããå 容ã«çµãè¾¼ãã§èª¬æãã¾ãã 使ç¨é »åº¦ã®å°ãªããã¤ãã¼ãªãããã£ï¼æ³¨ï¼ååºæºï¼ã«ã¤ãã¦ã¯èª¬æãã¾ããã å ·ä½çãªé ç®ã¯ä»¥ä¸ã®éãã§ãã ãããã£ã¨ã¯ä½ã to / not_to / to_not eq be be_xxx be_truthy / be_falsey change + from / to / by é å + include raise_error be_within + of ããããRSpecãå§ãã人ã¯ãã¡ãããä½åº¦ãRSpecã«è§¦ãã¦ããã¼ããRSpecã£ã¦ãããããããã¨ãªã£ã¦ãã人ããã®è¨äºã§åå ¥éãã¦ã¿ãã¨
ã¯ããã« ã¨ãã¨ãRSpec 3ãæ£å¼ã«å ¬éãããã®ã§ãæ©éææã¡ã®Railsããã¸ã§ã¯ããã¢ããã°ã¬ã¼ããã¦ã¿ã¾ããã ã¢ããã°ã¬ã¼ãããã®ã¯ãã©ã¤ãã¼ããªããã¸ã§ã¯ã4æ¬ã¨ãããªãã¯ãªããã¸ã§ã¯ã2æ¬ã®åè¨6æ¬ã§ãã ãã®è¨äºã§ã¯å®éã«RSpec 3ã«ã¢ããã°ã¬ã¼ããã¦ã¿ã¦å°ã£ãç¹ãæ°ä»ããç¹ãã¾ã¨ãã¦ã¿ã¾ãã 注æ: ãã®è¨äºã¯2014å¹´6æ4æ¥æç¹ã®æ å ±ã§ã ãã®è¨äºã¯2014å¹´6æ4æ¥æç¹ã®æ å ±ã§ãã gemã®ææ°ãã¼ã¸ã§ã³ãå¨è¾ºã©ã¤ãã©ãªã®å¯¾å¿ç¶æ³ãå¤åãã¦ããå¯è½æ§ãããã®ã§ãã¢ããã°ã¬ã¼ãããéã¯é©å®ãããä¸ã®ææ°æ å ±ã確èªããããã«ãã¦ãã ããã ã¢ããã°ã¬ã¼ãã®æé æé ã¯ãã£ããããã¨ãããªæãã§ãã ç¾è¡ã®ãã¹ããå ¨ã¦ãã¹ãããã¨ã確èªãã rspec-railsã®ãã¼ã¸ã§ã³ã2.99ã«ã¢ããã°ã¬ã¼ããã rspecãå®è¡ãã¦è¦åã確èªãã è¦åãæ½°ã rspec-
2014-10-17 TDDã諦ãããã¨ã¨ãRSpecããããã㨠Ruby on Rails Ruby RSpec éçºææ³ æè¿Webä¸ã§ãä»äºå ´ã§ããRSpecãããã¦å¥ã®ãã¹ããã¬ã¼ã ã¯ã¼ã¯ã«å¤ãããã¨æã£ã¦ããâ¦â¦ã¿ãããªè©±ãã¡ããã¡ããè¦èãããããã«ãªã£ããåãRuby on Railsã§éçºãå§ãã2012å¹´8æå½æããã§ã«RSpecã¯ãã¹ããã¬ã¼ã ã¯ã¼ã¯ã®ããã¡ã¯ãã¨è¨ã£ã¦ããã£ããä¸æã風é¡ããRSpecãããªãä»è¦ç´ããå§ãã¦ããã®ãã ãã£ããã«ãªã£ãã®ã¯ä»å¹´4æã®ãRailsä½è ã§ããDavid Heinemeier Hansson(以ä¸DHH)ã«ããTDD is deadçºè¨ã ã¨æãã 5æã«ã¯ãã®çºè¨ã«ããTDDã¸ã®é¢¨è©è¢«å®³ãéãè¦ãKent Beck*1ããã¬ããªã¼ã«Martin Fowler*2ãè¿ããDHHã¨ç¸å¯¾ããããªã¼ã ããããéå¬ãããããã®ä¼è«ã®
I'm fairly new to RoR and recently started learning BDD/Rspec for testing my application. I've been looking for a way to spec an AJAX request, but so far I haven't found much documentation on this at all. Anyone know how to do this? I'm using rails 2.3.8, rspec 1.3.0 and mocha 0.9.8 for my stubs (which I'm also in the process of learning...)
2013-06-23 RSpec Core 2.14 - åºæ¬çãªã¡ã½ãããªã©ã®ã¾ã¨ã æ´æ° : 2013/08/18 Rails Test RSpec RSpec ãç¿å¾ãããã¨æããgithub ã® README ã¨ããèªãããã¾ããã£ãããããè²ã ã¨è¨äºã èªãã§ããããhttps://www.relishapp.com/rspec/ ã詳細ã§åãããããã£ãã®ã§ã https://www.relishapp.com/rspec/rspec-core/docs ã®ä¸é¨ã®æ訳ãä¸å¿ã«ã¾ã¨ãã¦ã¿ããRSpec Expectations 2.14 - ãããã£ã¼ã®ã¾ã¨ã http://a-few-resources.hatenablog.com/entry/2013/06/24/181923RSpec Mocks 2.14 - Test Double, Method Stub, Me
UPDATED: I've updated the instructions based on feedback in the comments suggesting the use of the --dummy-path=spec/dummy --skip-test-unit options on the rails plugin new command. Recently, we've been doing a lot more with Rails engines. We've developed a few engines that we've released publicly, and even more that we use privately on applications. We've found it's a good way to organize and shar
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}