2019/01/14åã®ã³ãããã§ãã
CHANGELOGã¸ã®è¿½å ã¯ããã¾ããã§ããã
Merge pull request #34845 from palkan/feature/action-cable-connection-testing
actioncable/lib/action_cable/connection.rb
ã
actioncable/lib/action_cable/connection/test_case.rb
ã®ä¿®æ£ã§ãã
ActionCableã®connectionã®ãã¹ãã®çºã®ActionCable::Connection::TestCase
ã¯ã©ã¹ã追å ãã¦ãã¾ãã
使ç¨ä¾ã
class ApplicationCable::Connection < ActionCable::Connection::Base identified_by :user_id def connect self.user_id = request.params[:user_id] || cookies.signed[:user_id] reject_unauthorized_connection if user_id.nil? end def disconnect ActionCable.server.broadcast "users_presence", { id: user_id, event: "left" } end end class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase def test_connects_with_params # Simulate a connection opening connect params: { user_id: 42 } assert_equal connection.user_id, "42" end def test_connects_with_cookies # the same API as for integrations tests cookies.signed[:user_id] = 42 # just call connect without any arguments connect assert_equal connection.user_id, "42" end def test_reject_connection assert_reject_connection { connect } end end
Merge actioncable/README.md
to the Action Cable Overview guide [ci skip]
actioncable/README.md
ãrails guideã®Action Cable Overview
ã®ä¿®æ£ã§ãã
READMEã«ã®ã¿ãã£ãã³ã³ãã³ããguideã«ç§»è¡ãåã³ãéè¤ãã¦ããå 容ã®åé¤ãè¡ããREADMEã«ã¯guideã¸ã®ãªã³ã¯ãããããä¿®æ£ãã¦ãã¾ãã
å 容ã®éè¤ããã£ãã®ã¨ãã³ã³ãã³ãã®æ´æ°æ¼ã(guideã¯æ´æ°ãããREADMEã®æ´æ°ãè¡ãããªãã£ã)çããã£ãçºã
Fix "Action Cable Overview" guide [ci skip]
rails guideã®Action Cable Overview
ã®ä¿®æ£ã§ãã
channel generatorãçæãããã¡ã¤ã«ã®ãã¹åã«èª¤ãããã£ãã®ãä¿®æ£ãã¦ãã¾ãã
Update Action Cable connection testing.
actioncable/lib/action_cable/connection/test_case.rb
ã
actioncable/test/connection/test_case_test.rb
ã®ä¿®æ£ã§ãã
Action Cable connection testingã®ãªãã¡ã¯ã¿ãªã³ã°ã¨ãã¦ãä¸è¦ãªå¦çãåé¤ãdocã®ãã©ã¼ãããã»è¨ãåããä¿®æ£ãä¸è¶³ãã¦ãããã¹ãã®è¿½å ãçãè¡ã£ã¦ãã¾ãã