Skip to content

Commit

Permalink
Add tests for CableReady::Config (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth committed Feb 14, 2023
1 parent 4ed2e75 commit bd6efe2
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test/lib/cable_ready/config_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

require "test_helper"

class CableReady::ConfigTest < ActionView::TestCase
test "sets on_failed_sanity_checks" do
assert_equal :ignore, CableReady.config.on_failed_sanity_checks

CableReady.configure do |config|
config.on_failed_sanity_checks = :warn
end

assert_equal :warn, CableReady.config.on_failed_sanity_checks
end

test "sets broadcast_job_queue" do
assert_equal :default, CableReady.config.broadcast_job_queue

CableReady.configure do |config|
config.broadcast_job_queue = :something_else
end

assert_equal :something_else, CableReady.config.broadcast_job_queue
end

test "sets precompile_assets" do
assert CableReady.config.precompile_assets

CableReady.configure do |config|
config.precompile_assets = false
end

refute CableReady.config.precompile_assets
end

test "adds add_operation_name" do
refute_includes CableReady.config.operation_names, :jazz_hands

CableReady.configure do |config|
config.add_operation_name :jazz_hands
end

assert_includes CableReady.config.operation_names, :jazz_hands
end

test "sets on_new_version_available" do
assert_equal :ignore, CableReady.config.on_new_version_available

CableReady.configure do |config|
config.on_new_version_available = :warn
end

assert_equal :warn, CableReady.config.on_new_version_available
end
end

0 comments on commit bd6efe2

Please sign in to comment.