Skip to content

Commit

Permalink
Execute CI against rails/rails main (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpdoyle committed Oct 9, 2021
1 parent d4e5c44 commit 12b0962
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 255 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -7,6 +7,9 @@ jobs:
ruby-version:
- "2.7"
- "3.0"
rails-version:
- "6.1"
- "main"
continue-on-error: [ false ]

# Disabled until minitest relaxes its upper bound: https://github.com/seattlerb/minitest/pull/862
Expand All @@ -16,7 +19,10 @@ jobs:
# - ruby-version: head
# continue-on-error: true

name: ${{ format('Tests (Ruby {0})', matrix.ruby-version) }}
env:
RAILS_VERSION: "${{ matrix.rails-version }}"

name: ${{ format('Tests (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.continue-on-error }}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
*.gem
/node_modules
Gemfile.lock
11 changes: 11 additions & 0 deletions Gemfile
Expand Up @@ -2,6 +2,17 @@ source 'https://rubygems.org'

gemspec

rails_version = ENV.fetch("RAILS_VERSION", "6.1")

if rails_version == "main"
rails_constraint = { github: "rails/rails" }
gem "sprockets-rails"
else
rails_constraint = "~> #{rails_version}.0"
end

gem "rails", rails_constraint

gem 'rake'
gem 'byebug'
gem 'puma'
Expand Down
183 changes: 0 additions & 183 deletions Gemfile.lock

This file was deleted.

30 changes: 15 additions & 15 deletions test/streams/broadcastable_test.rb
Expand Up @@ -19,85 +19,85 @@ class Turbo::BroadcastableTest < ActionCable::Channel::TestCase
end

test "broadcasting replace to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("replace", target: "message_1", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("replace", target: "message_1", template: render(@message)) do
@message.broadcast_replace_to "stream"
end
end

test "broadcasting replace now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("replace", target: "message_1", template: "<p>Hello!</p>") do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("replace", target: "message_1", template: render(@message)) do
@message.broadcast_replace
end
end

test "broadcasting update to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("update", target: "message_1", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("update", target: "message_1", template: render(@message)) do
@message.broadcast_update_to "stream"
end
end

test "broadcasting update now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("update", target: "message_1", template: "<p>Hello!</p>") do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("update", target: "message_1", template: render(@message)) do
@message.broadcast_update
end
end

test "broadcasting before to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("before", target: "message_1", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("before", target: "message_1", template: render(@message)) do
@message.broadcast_before_to "stream", target: "message_1"
end
end

test "broadcasting after to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("after", target: "message_1", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("after", target: "message_1", template: render(@message)) do
@message.broadcast_after_to "stream", target: "message_1"
end
end

test "broadcasting append to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("append", target: "messages", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("append", target: "messages", template: render(@message)) do
@message.broadcast_append_to "stream"
end
end

test "broadcasting append to stream with custom target now" do
assert_broadcast_on "stream", turbo_stream_action_tag("append", target: "board_messages", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("append", target: "board_messages", template: render(@message)) do
@message.broadcast_append_to "stream", target: "board_messages"
end
end

test "broadcasting append now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("append", target: "messages", template: "<p>Hello!</p>") do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("append", target: "messages", template: render(@message)) do
@message.broadcast_append
end
end

test "broadcasting prepend to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("prepend", target: "messages", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("prepend", target: "messages", template: render(@message)) do
@message.broadcast_prepend_to "stream"
end
end

test "broadcasting prepend to stream with custom target now" do
assert_broadcast_on "stream", turbo_stream_action_tag("prepend", target: "board_messages", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("prepend", target: "board_messages", template: render(@message)) do
@message.broadcast_prepend_to "stream", target: "board_messages"
end
end

test "broadcasting prepend now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("prepend", target: "messages", template: "<p>Hello!</p>") do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("prepend", target: "messages", template: render(@message)) do
@message.broadcast_prepend
end
end

test "broadcasting action to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("prepend", target: "messages", template: "<p>Hello!</p>") do
assert_broadcast_on "stream", turbo_stream_action_tag("prepend", target: "messages", template: render(@message)) do
@message.broadcast_action_to "stream", action: "prepend"
end
end

test "broadcasting action now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("prepend", target: "messages", template: "<p>Hello!</p>") do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("prepend", target: "messages", template: render(@message)) do
@message.broadcast_action "prepend"
end
end
Expand All @@ -111,7 +111,7 @@ class Turbo::BroadcastableTest < ActionCable::Channel::TestCase

test "local variables don't get overwritten if they collide with the template name" do
@profile = Users::Profile.new(id: 1, name: "Ryan")
assert_broadcast_on @profile.to_param, turbo_stream_action_tag("replace", target: "users_profile_1", template: "<p>Hello!</p>") do
assert_broadcast_on @profile.to_param, turbo_stream_action_tag("replace", target: "users_profile_1", template: render(@message)) do
@profile.broadcast_replace partial: 'messages/message', locals: { message: @message }
end
end
Expand Down

0 comments on commit 12b0962

Please sign in to comment.