introduction to guard + rspec

Download Introduction to guard + rspec

Post on 11-Nov-2014

2.342 views

Category:

Technology

0 download

Embed Size (px)

DESCRIPTION

presentation file for minamirb

TRANSCRIPT

  • 1. Guard Rspec + Spork 23101()KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 2. Guard Rspec + Spork : ( ) : @koko_u : SIer, COBOL-er, Excel-er, : ( ) ( ) ( ) (soft): Ruby, Rails, Scala, Play!, ... (hard): Sony Reader, Android, ThinkPad, Happy Hacking Keyboard, ...KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 3. Guard Rspec + Spork Guard + Spork KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 4. Guard Rspec + Spork guard spork KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 5. Guard Rspec + Spork KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 6. Guard Rspec + Spork KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 7. Guard Rspec + Spork ... 01 # wrong_hello.rb 02 def wrong_hello(name) 03 if name.nil? 04 puts "you are nil boy" 05 elseif name.empty? 06 puts "you are empty girl" 07 else 08 puts "hello #{name}" 09 end 10 endKOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 8. Guard Rspec + Spork 1 require ./wrong_hello 2 wrong_hello koko_u 3 4 # => hello koko_uKOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 9. Guard Rspec + Spork 1 require ./wrong_hello 2 wrong_hello 3 4 # => hello ... empty girl KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 10. Guard Rspec + Spork ... 1 require ./wrong_hello 2 wrong_hello nil 3 4 # => `wrong_hello: undefined method `empty? for nil:NilClass (NoMethodError) KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 11. Guard Rspec + Spork typo KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 12. Guard Rspec + Spork Guard + Spork notify autotest (Zentest) watchr KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 13. Guard Rspec + Spork guard spork 1. guard 2. KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 14. Guard Rspec + Spork Spork Guard Rails Spork Rails KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 15. Guard Rspec + Spork KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 16. Guard Rspec + Spork OS : Ubuntu 11.04 Ruby : 1.9.2-p180 Rails : 3.1.0 Testing Framework : RSpec Mac growl gem Windows Rails 3.0.x 3.1.0 3.1 Testing Framework RSpec Test::Unit gem KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 17. Guard Rspec + Spork 1. Rails (6 ) 2. Spork (4 ) 3. Guard (4 ) KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 18. Guard Rspec + Spork Rails (1/6) $ rails new guard_demo -T --skip-bundle create create README create Rakefile create config.ru create .gitignore create Gemfile create app ... Testing Framework Test::Unit RSpec -T test Rails 3.1.0 bundle install Gemfile bundle install KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 19. Guard Rspec + Spork Rails (2/6) Gemfile 1 group :test, :development do 2 gem rspec-rails 3 gem spork, ~> 0.9.0.rc 4 gem guard-rspec 5 gem guard-spork 6 gem rb-inotify 7 gem libnotify 8 end spork 0.9.0.rc Rails 3.0 Mac 2 1 group :test, :development do 2 gem rspec-rails 3 gem spork, ~> 0.9.0.rc 4 gem guard-rspec 5 gem guard-spork 6 gem rb-fsevent 7 gem growl_notify 8 endKOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 20. Guard Rspec + Spork Rails (3/6) bundle install $ bundle install --path=vendor/bundle Fetching source index for http://rubygems.org/ Installing rake (0.9.2) Installing multi_json (1.0.3) Installing activesupport (3.1.0) Installing bcrypt-ruby (3.0.0) with native extensions Installing builder (3.0.0) Installing i18n (0.6.0) Installing activemodel (3.1.0) ... --path --skip-bundle KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 21. Guard Rspec + Spork Rails (4/6) RSpec $ rails generate rspec:install create .rspec create spec create spec/spec_helper.rbKOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 22. Guard Rspec + Spork Rails (5/6) $ rails generate scaffold Article name:string title:string content:text invoke active_record create db/migrate/20110905165645_create_articles.rb create app/models/article.rb invoke rspec create spec/models/article_spec.rb route resources :articles invoke scaffold_controller ... RSpec KOZAKI Tsuneaki Slippy on githubBlog Forever Undecided Twitter @koko_u
  • 23. Guard Rspec + Spork Rails (6/6) tent:text $ rake db:migrate RAILS_ENV=test $ bundle exec rspec spec ........................**.... Pending: Article add some examples to (or delete) /home/kozaki/minamirb/intro_guard_r # Not Yet Implemented # ./spec/models/article_spec.rb:4 ArticlesHelper add some examples to (or delete) /home/kozaki/minamirb/intro_ # Not Yet Implemented # ./spec/helpers/articles_helper_spec.rb:14 Finished in 0.35449 seconds 30 examples, 0 failures, 2 pending KOZAKI Tsuneaki Slippy on github Blog Forever Undecided Twitter @koko_u
  • 24. Guard Rspec + Spork Spork (1/4) spork tent:text $ bundle exec spork --bootstrap Using RSpec B