SimpleCov ã使ã£ã¦code coverageãåãã¨ãã« spec_helper.rb ã«ãããªæãã§æ¸ãã¦ãã if ENV['COVERAGE'] # <= rake spec / rake coverage ãåãããæ´¾ãªã®ã§ require "simplecov" SimpleCov.start :test_frameworks do add_filter "/vendor/bundle/" end end # 以ä¸ç¥ RSpec.configure do |config| # ãããç¥... end ããã°ã©ã ã®root pathã« .simplecov ã¨ããååã®ãã¡ã¤ã«ãä½ããSimpleCov ã®è¨å®é¨åãæ¸ãã¦ãã¾ããã¨ãåºæ¥ãããã«ãªã£ã¦ããããã (ã¨ãããã¨ã«æ°ä»ãã .simplecov SimpleCov.start :test_frameworks
Rails SimpleCovã§ã«ãã¬ãã¸ãä¸æ¸ããããªãããã«ãã Railsã®ãã¹ãã®ã«ãã¬ãã¸ã«SimpleCovã使ã£ã¦ãã¾ãã bundle exec rake test COVERAGE=trueãå®è¡ããã¨ãControllerãModelã®ãã¹ããé çªã«å®è¡ããã¾ãããcoverage/index.htmlã«ã¯ä¸é¨ã®å®è¡çµæã®ã¿ãæ®ã£ã¦ãã¾ããã å ·ä½çã«ã¯Modelã®ãã¹ãçµæãControllerã®ãã¹ãã§ä¸æ¸ããããç¶æ ã§ãã 調ã¹ã¦ã¿ãã¨SimpleCov.command_nameãããããå¥ã®ååã«ãªãããã«ããã°ãã¾ããã¼ã¸ããããã¨ããããã¾ããã test_helper.rbã«æ¬¡ã®ãããªè¨å®ãå ¥ãã¾ããã : require 'simplecov' SimpleCov.start do add_filter "/test/" add_filter "/con
ã¯ããã« å é±ã®åææ¥ï¼2015å¹´5æ16æ¥ï¼ã«è¥¿è.rbï¼ç¥æ¸.rbã§ãRubyistã®ããã®ãã¹ãã³ã¼ãç¸è«ä¼ ï½ãã¹ãã®æ¸ãæ¹ã«æ©ãã§ãã¾ãããï¼ï½ãã¨ããåå¼·ä¼ãéå¬ãã¾ããã ãã®åå¼·ä¼ã¯ããã¹ãã³ã¼ãã«é¢ããçåãæ©ã¿ãã¿ããªã§æã¡å¯ããã¿ããªã§è§£æ±ºãããã¨ããç®çã«ããåå¼·ä¼ã§ãã åå¼·ä¼ä¸ã¯ããããã¨èå³æ·±ãè°è«ãåºãã®ã§ãä»åã®ã¨ã³ããªã§ã¯ãã®å 容ãç°¡åã«ã¾ã¨ãã¦ã¿ã¾ãã åå¼·ä¼ã§æãã£ã質çå¿ç ãã使ããã¬ã¼ã ã¯ã¼ã¯ã¯ï¼ RSpecã大å¤æ°ãMinitestãè¥å¹²åã gemãéçºããã¨ãã¯MinitestãRailsã¯RSpecãã¨ããããã«éçºå 容ã«ãã£ã¦ãã¬ã¼ã ã¯ã¼ã¯ã使ãåãããã¨ãã人ãããã Minitestã£ã¦ã©ããªã®ï¼ å°å ¥ãç°¡åãassertã¡ã½ããã ãç¥ã£ã¦ããã°ãªãã¨ããªãã Railsã«ã対å¿ãã¦ãããCapybaraã使ããã RSpecã®s
ãã¹ããæ¸ããªãã«ãã¬ãã¸è¨æ¸¬ã¨è¡åä½ã§éã£ãã»éã£ã¦ãªãã®ç¢ºèªãã§ããããããªãã¨æã£ã¦ããã @tmtms ãããããSimpleCovããæãã¦ããã ãã¾ããã GitHub - colszowka/simplecov: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites å°å ¥æé Gemfileã«ãsimplecovãã追å group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' gem 'rspec-rail
èªåã®æ¸ãããã¹ãããå ¨ä½ã³ã¼ãã®ä½å²ãå ãã¦ãããã示ãææ¨ããã¹ãã«ãã¬ãã¸ã¨ããã¾ããæ°å¤åãããã®ã§ãã¹ãã®å¦¥å½æ§ã®æ¤è¨¼ã«å½¹ç«ã¡ã¾ãã ä»åã¯ãã®ã«ãã¬ãã¸ã調ã¹ãRubyã©ã¤ãã©ãª simplecov ã調ã¹ã¦ã¿ã¾ããã ã¤ã³ã¹ãã¼ã« gemããã±ã¼ã¸ã§ãã®ã§æ¬¡ã®éãã¤ã³ã¹ãã¼ã«ãã¾ãã $ gem install simplecov rails ã§ä½¿ãå ´åã¯ãGemfile ã«æ¬¡ã®ããã«è¿½å ãã¦bundle ãã¾ãã gem 'simplecov', :require=>false, :group=>true ãã¹ãã§è¨æ¸¬ã®æã« require ããã®ã§ããã§ã¯èªã¿è¾¼ã¾ãªããããã¾ã 使ãæ¹ ãã«ãã¡ã½ããã«è¿½å (ååã®ã¿) test/test_helper.rb (RSpecã®å ´å㯠spec/spec_helper)ã®ä¸çªæåã«æ¬¡ã®è¡ã追å ãã¾ã require 'simp
Testing Casual Talks#2ã«è¡ã£ã¦ãã¾ãããããããã°ã«ãã¬ãã¸ã®è©±ããªãã£ããªã¨æã£ãã®ã§ã以å調æ»ããçµæãå ±æãããã¨æãã¾ãã ãã¼ã¸ã§ã³ã¨ã ruby (2.1.5) simplecov (0.9.2) ã«ãã¬ãã¸(ç¶²ç¾ ç)ã¨ã¯ ããåºã¦ããã«ãã¬ãã¸ã¯ä¸è¨ã®ï¼ç¨®é¡ã§ãããã å½ä»¤ç¶²ç¾ ï¼C0ï¼ ãã¹ãå ã§å®è¡ãããã¡ã½ããã®å²åãæå³ãã åå²ç¶²ç¾ ï¼C1ï¼ ãã¹ãå ã§å®è¡ãããåå²ã®å²åãæå³ãã æ¡ä»¶ç¶²ç¾ ï¼C2ï¼ ãã¹ãå ã§å®è¡ãããåå²ã®çµã¿åããã®å²åãæå³ãã ãã®ãããªã³ã¼ãããã£ãã¨ãã¾ããããå½ä»¤ç¶²ç¾ ã®å ´åãã©ã®ãããªå¼æ°ã§ããtestã¡ã½ããããã¹ããã¦ããã°ãã«ãã¬ãã¸ã¯100%ã«ãªãã¾ããåå²ç¶²ç¾ ã®å ´åãä¾ãã°x = 1, y = 10ã¨x = 2, y = 10ã§testã¡ã½ãããå¼ã³åºãã¦ããã°ãã«ãã¬ãã¸ã¯100%ã«ãªãã¾ããæ¡ä»¶ç¶²ç¾ ã®
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}