发布于 2018-11-08 20:50:33
动作-电缆测试宝石包括对测试Connections的支持。
下面是文档中给出的RSpec示例:
require "rails_helper"
RSpec.describe ApplicationCable::Connection, type: :channel do
it "successfully connects" do
connect "/cable", headers: { "X-USER-ID" => "325" }
expect(connection.user_id).to eq "325"
end
it "rejects connection" do
expect { connect "/cable" }.to have_rejected_connection
end
endhttps://stackoverflow.com/questions/53199606
复制相似问题