What’s cultureand tools inRuby worlds.                  SHIBATA Hiroshi     Eiwa System Management,Inc.
SHIBATA Hiroshi   a.k.a hsbtshibata.hiroshi@gmail.com  tDiary commiter
http://www.hsbt.org/http://github.com/hsbt/http://twitter.com/hsbt/
asakusa.rb
SapporoRubyKaigi   03
SapporoRubyKaigi01
SapporoRubyKaigi02
tDiary
RubyKaigi  2010
Conflicts   andResolutions
ThoughtWorks
Sudhindra Rao
Sudhindra Rao
Culture
ESMCulture and Tool
Why?
Ruby WorldConference  2010
http://www.flickr.com/photos/14403423@N05/4979310028
RSpec
metric_fu
Rails
mock / stub
rspec-mocksrrmochaflexmock
rr
stubstub(User).find { value }User.find -> ‘value’any_incetance_of(User) do |u|    stub(u).name { ‘alice’ }end@u = User.new...
mockmock(User).find.twice { value }User.find -> ‘value’mock(User).all.mock!.count { 10 }User.all.count -> 10
Expectationsclass User  self.def import!    File.open(‘export.csv’).read  endend
Expectationsbefore  mock(File).open.with_any_args.  mock!.read { ‘alice,bob’ }endit “#impot!” do  User.import!.    should ...
webmockstub_request(:post, "www.example.com").  with(:body => "alice").  to_return(:status => 200)stub_request(:post, "www...
stubmock
Test Fixture# wineries.yml                # wines.ymlsunnyside:                    merlot:  name: Sunnyside Vineyards     ...
harmful
fixturereplacement
factory_girlFactoryGirl.define do    factory :user do      first_name John      last_name Doe      admin false    endendus...
factory_girlFactoryGirl.sequence :email do |n|  "person#{n}@example.com"endFactory.next :email# => "person1@example.com"
Machinist Post.blueprint do   author   title { "Post #{sn}" }   body   { "Lorem ipsum..." } endpost = Post.makepost = Post...
mongodb supportMachinist Mongo  Fabrication
Capybara
end-to-end testintegration testacceptance test
DSLfeature            do  background do    setup_tdiary  end  scenario                do    visit /    within(title) do   ...
Selenium Webdriver
RSpec.configure do |config|  config.include Capybara, :type=> :acceptance  Capybara.register_driver :selenium do |app|    ...
http://www.flickr.com/photos/mfp/4186901873
ContinuousIntegration
paralell_tests
% rake parallel:spec/Users/hsbt/.gem/ruby/1.8/gems/parallel_tests-0.4.9/lib/parallel_tests.rb:6: warning: already initiali...
http://www.ne.jp/asahi/t/wada/articles/Refactoring_and_Test.pdf
Spork
require rubygemsrequire sporkSpork.prefork do  ENV["RAILS_ENV"] ||= test  require File.expand_path(File.join(File.dirname(...
Guard::RSpec/Zentest
ContinuousIntegration
DRY
get_number → number                 size or count  map     if not item → unless itemnil? or empty?        flatten
RSpec::Matchers.define :be_encoded_sjis do  match do |actual|    NKF.guess(actual) == NKF::SJIS  end  description do    "b...
•http://github.com/rspec/rspec•http://github.com/jscruggs/metric_fu•http://github.com/btakita/rr•http://github.com/bblimke...
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Sapporo rubykaigi03
Upcoming SlideShare
Loading in …5
×

Sapporo rubykaigi03

3,211 views

Published on

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,211
On SlideShare
0
From Embeds
0
Number of Embeds
32
Actions
Shares
0
Downloads
18
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Sapporo rubykaigi03

  1. 1. What’s cultureand tools inRuby worlds. SHIBATA Hiroshi Eiwa System Management,Inc.
  2. 2. SHIBATA Hiroshi a.k.a hsbtshibata.hiroshi@gmail.com tDiary commiter
  3. 3. http://www.hsbt.org/http://github.com/hsbt/http://twitter.com/hsbt/
  4. 4. asakusa.rb
  5. 5. SapporoRubyKaigi 03
  6. 6. SapporoRubyKaigi01
  7. 7. SapporoRubyKaigi02
  8. 8. tDiary
  9. 9. RubyKaigi 2010
  10. 10. Conflicts andResolutions
  11. 11. ThoughtWorks
  12. 12. Sudhindra Rao
  13. 13. Sudhindra Rao
  14. 14. Culture
  15. 15. ESMCulture and Tool
  16. 16. Why?
  17. 17. Ruby WorldConference 2010
  18. 18. http://www.flickr.com/photos/14403423@N05/4979310028
  19. 19. RSpec
  20. 20. metric_fu
  21. 21. Rails
  22. 22. mock / stub
  23. 23. rspec-mocksrrmochaflexmock
  24. 24. rr
  25. 25. stubstub(User).find { value }User.find -> ‘value’any_incetance_of(User) do |u| stub(u).name { ‘alice’ }end@u = User.new@u.name -> ‘alice’
  26. 26. mockmock(User).find.twice { value }User.find -> ‘value’mock(User).all.mock!.count { 10 }User.all.count -> 10
  27. 27. Expectationsclass User self.def import! File.open(‘export.csv’).read endend
  28. 28. Expectationsbefore mock(File).open.with_any_args. mock!.read { ‘alice,bob’ }endit “#impot!” do User.import!. should eq ‘alice,bob’end
  29. 29. webmockstub_request(:post, "www.example.com"). with(:body => "alice"). to_return(:status => 200)stub_request(:post, "www.example.com"). to_timeout
  30. 30. stubmock
  31. 31. Test Fixture# wineries.yml # wines.ymlsunnyside: merlot:  name: Sunnyside Vineyards   name: Sunnyside Reserve  city: Sonoma   year: 2003  state: CA   family: Merlot  country: USA   winery: sunnyside rake db:fixtures:load
  32. 32. harmful
  33. 33. fixturereplacement
  34. 34. factory_girlFactoryGirl.define do factory :user do first_name John last_name Doe admin false endenduser = Factory.build(:user)user = Factory.create(:user)
  35. 35. factory_girlFactoryGirl.sequence :email do |n| "person#{n}@example.com"endFactory.next :email# => "person1@example.com"
  36. 36. Machinist Post.blueprint do author title { "Post #{sn}" } body { "Lorem ipsum..." } endpost = Post.makepost = Post.make!(:body => ‘bob’)
  37. 37. mongodb supportMachinist Mongo Fabrication
  38. 38. Capybara
  39. 39. end-to-end testintegration testacceptance test
  40. 40. DSLfeature do background do setup_tdiary end scenario do visit / within(title) do page.should have_content( ) } end within(h1) do page.should have_content( ) end page.should have_css(a[href="update.rb"])! endend
  41. 41. Selenium Webdriver
  42. 42. RSpec.configure do |config| config.include Capybara, :type=> :acceptance Capybara.register_driver :selenium do |app| Capybara::Driver::Selenium.new(app, :browser => :chrome) end config.before(:all, :selenium => true) do Capybara.current_driver = :selenium endend
  43. 43. http://www.flickr.com/photos/mfp/4186901873
  44. 44. ContinuousIntegration
  45. 45. paralell_tests
  46. 46. % rake parallel:spec/Users/hsbt/.gem/ruby/1.8/gems/parallel_tests-0.4.9/lib/parallel_tests.rb:6: warning: already initialized constantVERSION2 processes for 63 specs, ~ 31 specs perprocessNo DRb server is running. Running in localprocess instead ...No DRb server is running. Running in localprocess instead ................................................................................................................
  47. 47. http://www.ne.jp/asahi/t/wada/articles/Refactoring_and_Test.pdf
  48. 48. Spork
  49. 49. require rubygemsrequire sporkSpork.prefork do ENV["RAILS_ENV"] ||= test require File.expand_path(File.join(File.dirname(__FILE__),..,config,environment)) require email_spec require database_cleanerend
  50. 50. Guard::RSpec/Zentest
  51. 51. ContinuousIntegration
  52. 52. DRY
  53. 53. get_number → number size or count map if not item → unless itemnil? or empty? flatten
  54. 54. RSpec::Matchers.define :be_encoded_sjis do match do |actual| NKF.guess(actual) == NKF::SJIS end description do "be encoded with Shift_JIS" endend
  55. 55. •http://github.com/rspec/rspec•http://github.com/jscruggs/metric_fu•http://github.com/btakita/rr•http://github.com/bblimke/webmock•http://github.com/thoughtbot/factory_girl•http://github.com/notahat/machinist•http://github.com/nmerouze/machinist_mongo•http://github.com/paulelliott/fabrication•http://github.com/jnicklas/capybara•http://code.google.com/p/selenium/•http://hudson-ci.org/•http://github.com/grosser/parallel_tests•http://github.com/timcharper/spork•http://github.com/guard/guard-rspec

×