Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Railsでつくる 画像アップロード 2017 #railsdm /rails_develop...

matsuhisa
October 19, 2017

Railsでつくる 画像アップロード 2017 #railsdm /rails_developers_meetup6_image_upload

matsuhisa

October 19, 2017
Tweet

More Decks by matsuhisa

Other Decks in Programming

Transcript

  1. ͖͔͚ͬ w 3BJMT͔Βඪ४ʹͳΔHFN w ೥݄೔ʹ%))͕౜ಥʹʜ w ΋͏ɺ$MPVE4UPSBHF͸౰ͨΓલͩΑͶɺͱ͍͏ࢥ͍Λײ͡Δ w ฐࣾ΋ɺ4ʢ"84ʣΛར༻த w

    ($1ʢ(PPHMF$MPVE1MBUGPSNʣʹ͸ը૾ͷϦαΠζػೳ͕͋Δ͠ɺ ഑৴΋OHJOYΛ௨ͯ͠ϦαΠζ͠ͳͯ͘΋͍͍͔΋͠Εͳ͍ "DUJWF4UPSBHFͷొ৔
  2. 3BJMTͰը૾ΞοϓϩʔυΛ࡞Δ w 3BJMT͔Βಋೖ w MPDBMUSVFʹ͠ͳ͍ͱࠓ·ͰͷΑ͏ͳಈ࡞͠ͳ͍ͷͰযͬͨʜ GPSN@XJUI = form_with model: @images,

    url: confirm_images_path, local: true do |f| - if @images.errors.any? %h2= "#{pluralize(@images.errors.count, "error")} saved:" %ul - @images.errors.full_messages.each do |message| %li= message
  3. 3BJMTͰը૾ΞοϓϩʔυΛ࡞Δ w .BDͰ͋Ε͹ɺCSFXͰΠϯετʔϧՄೳ w ඞཁͳHFN͸Լهͷ௨Γ )FBEMFTTCSPXTFS brew install chromedriver ChromeDriver

    2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b) group :development, :test do gem 'capybara' gem 'selenium-webdriver' end
  4. 3BJMTͰը૾ΞοϓϩʔυΛ࡞Δ )FBEMFTTCSPXTFS require 'capybara' require 'capybara/dsl' require 'selenium-webdriver' Capybara.register_driver :selenium

    do |app| Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome( chrome_options: { args: %w(headless disable-gpu window-size=1680,1050), }, ) ) end
  5. 3BJMTͰը૾ΞοϓϩʔυΛ࡞Δ w "DUJPO%JTQBUDI)UUQ6QMPBEFE'JMFͷ͜ͱΛ๨Ε͕ͪ w ςΩετ΍਺஋ͳͲଘࡏҎ֎Λ๨Ε͕ͪʜ w 7BMJEBUF͕࣠ʹͳΔ w ը૾ϑΝΠϧࣗମʢϑΝΠϧ༰ྔɺछྨͳͲʣ w

    ը૾ͱඥͮ͘৘ใʢը૾ͷઆ໌ͱ͔ʣ w ϑΥʔϜΦϒδΣΫτͰॲཧ͢Δͱྑͦ͞͏ w ʮGPSNPCKFDUΛ࢖ͬͯΈΑ͏ϝυϐΞ։ൃऀϒϩάʯʢ!XJMMOFUʣ 4UFQ̍ɿQVCMJDʹը૾Ξοϓϩʔυ
  6. 3BJMTͰը૾ΞοϓϩʔυΛ࡞Δ w 4ʹ͍ͭͯ஌Δඞཁ͕͋Δ w ೝূʹ͍ͭͯͷཧղɻDSFEFOUJBMTɺ*".ͳͲ w όέοτࣗମͷΞΫηε੍ޚ w ϋϚΓ·ͨ͠ʜ w

    ςετͰ͸΢ΣϒϞοΫʹ͍ͭͯ஌Δඞཁ͕͋Δ w 4ʹςετͰΞοϓϩʔυ͸ͨ͘͠ͳ͍ʢ΍ͬͯͨʜʣ 4UFQɿ4ʹը૾Ξοϓϩʔυ
  7. 3BJMTͰը૾ΞοϓϩʔυΛ࡞Δ w 4ʹ͸+BWB4DSJQU͔ΒͰ΋ΞοϓϩʔυͰ͖Δํ๏͕͋Δ w ($1"[VSFʹ΋͋ΔʢΈ͍͚ͨͩΕͲࢼ͍ͯ͠ͳ͍ʣ w ྲྀΕ w +BWB4DSJQUͰɺϑΝΠϧʹ͍ͭͯ৘ใΛऔಘ w

    αʔόʔଆʹ1PTUͯ͠4ʹඞཁͳҰ࣌తͳೝূ৘ใΛฦ͢ w +BWB4DSJQUͰೝূ৘ใΛར༻ͯ͠4ʹ1PTU w $BMM#BDLΛར༻ͯ͠ॲཧ 4UFQɿμΠϨΫτΞοϓϩʔυʢ4ʣ