Skip to content

Commit 105e4b5

Browse files
claudejustin808
authored andcommitted
Remove obsolete pro_warning_badge tests
Remove test contexts that verified the warning badge HTML and logging behavior: - Remove 'with Pro license warning' contexts from react_component tests - Remove 'with Pro license warning' contexts from react_component_hash tests - Remove 'with Pro license warning' contexts from redux_store tests These tests are no longer needed since the badge functionality has been removed. Pro features are now silently disabled when Pro is not installed, without displaying warnings or badges. Total: ~90 lines removed from test file
1 parent 1d349cb commit 105e4b5

File tree

1 file changed

+0
-152
lines changed

1 file changed

+0
-152
lines changed

spec/dummy/spec/helpers/react_on_rails_helper_spec.rb

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -392,78 +392,6 @@ def helper.append_javascript_pack_tag(name, **options)
392392
it { is_expected.to include immediate_hydration_script }
393393
end
394394
end
395-
396-
describe "with Pro license warning" do
397-
let(:badge_html_string) { "React On Rails Pro Required" }
398-
399-
before do
400-
allow(Rails.logger).to receive(:warn)
401-
end
402-
403-
context "when Pro license is NOT installed and immediate_hydration is true" do
404-
subject(:react_app) { react_component("App", props: props, immediate_hydration: true) }
405-
406-
before do
407-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(false)
408-
end
409-
410-
it { is_expected.to include(badge_html_string) }
411-
412-
it "logs a warning" do
413-
react_app
414-
expect(Rails.logger).to have_received(:warn)
415-
.with(a_string_matching(/The 'immediate_hydration' feature requires/))
416-
end
417-
end
418-
419-
context "when Pro license is NOT installed and global immediate_hydration is true" do
420-
subject(:react_app) { react_component("App", props: props) }
421-
422-
before do
423-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(false)
424-
end
425-
426-
around do |example|
427-
ReactOnRails.configure { |config| config.immediate_hydration = true }
428-
example.run
429-
ReactOnRails.configure { |config| config.immediate_hydration = false }
430-
end
431-
432-
it { is_expected.to include(badge_html_string) }
433-
end
434-
435-
context "when Pro license is NOT installed and immediate_hydration is false" do
436-
subject(:react_app) { react_component("App", props: props, immediate_hydration: false) }
437-
438-
before do
439-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(false)
440-
end
441-
442-
it { is_expected.not_to include(badge_html_string) }
443-
444-
it "does not log a warning" do
445-
react_app
446-
expect(Rails.logger).not_to have_received(:warn)
447-
end
448-
end
449-
450-
context "when Pro license IS installed and immediate_hydration is true" do
451-
subject(:react_app) { react_component("App", props: props, immediate_hydration: true) }
452-
453-
before do
454-
allow(ReactOnRails::Utils).to receive_messages(
455-
react_on_rails_pro?: true
456-
)
457-
end
458-
459-
it { is_expected.not_to include(badge_html_string) }
460-
461-
it "does not log a warning" do
462-
react_app
463-
expect(Rails.logger).not_to have_received(:warn)
464-
end
465-
end
466-
end
467395
end
468396

469397
describe "#react_component_hash" do
@@ -486,40 +414,6 @@ def helper.append_javascript_pack_tag(name, **options)
486414
expect(react_app).to have_key("componentHtml")
487415
expect(react_app).to have_key("title")
488416
end
489-
490-
context "with Pro license warning" do
491-
let(:badge_html_string) { "React On Rails Pro Required" }
492-
493-
before do
494-
allow(Rails.logger).to receive(:warn)
495-
end
496-
497-
context "when Pro license is NOT installed and immediate_hydration is true" do
498-
subject(:react_app) { react_component_hash("App", props: props, immediate_hydration: true) }
499-
500-
before do
501-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(false)
502-
end
503-
504-
it "adds badge to componentHtml" do
505-
expect(react_app["componentHtml"]).to include(badge_html_string)
506-
end
507-
end
508-
509-
context "when Pro license IS installed and immediate_hydration is true" do
510-
subject(:react_app) { react_component_hash("App", props: props, immediate_hydration: true) }
511-
512-
before do
513-
allow(ReactOnRails::Utils).to receive_messages(
514-
react_on_rails_pro?: true
515-
)
516-
end
517-
518-
it "does not add badge to componentHtml" do
519-
expect(react_app["componentHtml"]).not_to include(badge_html_string)
520-
end
521-
end
522-
end
523417
end
524418

525419
describe "#redux_store" do
@@ -544,52 +438,6 @@ def helper.append_javascript_pack_tag(name, **options)
544438
it {
545439
expect(expect(store).target).to script_tag_be_included(react_store_script)
546440
}
547-
548-
context "with Pro license warning" do
549-
let(:badge_html_string) { "React On Rails Pro Required" }
550-
551-
before do
552-
allow(Rails.logger).to receive(:warn)
553-
end
554-
555-
context "when Pro license is NOT installed and immediate_hydration is true" do
556-
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
557-
558-
before do
559-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(false)
560-
end
561-
562-
it { is_expected.to include(badge_html_string) }
563-
564-
it "logs a warning" do
565-
store
566-
expect(Rails.logger).to have_received(:warn)
567-
.with(a_string_matching(/The 'immediate_hydration' feature requires/))
568-
end
569-
end
570-
571-
context "when Pro license is NOT installed and immediate_hydration is false" do
572-
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: false) }
573-
574-
before do
575-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(false)
576-
end
577-
578-
it { is_expected.not_to include(badge_html_string) }
579-
end
580-
581-
context "when Pro license IS installed and immediate_hydration is true" do
582-
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
583-
584-
before do
585-
allow(ReactOnRails::Utils).to receive_messages(
586-
react_on_rails_pro?: true
587-
)
588-
end
589-
590-
it { is_expected.not_to include(badge_html_string) }
591-
end
592-
end
593441
end
594442

595443
describe "#server_render_js", :js, type: :system do

0 commit comments

Comments
 (0)