Skip to content

Commit e403bc3

Browse files
Remove obsolete Pro warning badge tests
Since the Pro warning badge functionality has been removed (users can't enable Pro features without Pro gem installed), all tests related to the warning badge are now obsolete and have been removed. Tests removed: - react_component: 'with Pro license warning' context (4 test cases) - react_component_hash: 'with Pro license warning' context (2 test cases) - redux_store: 'with Pro license warning' context (3 test cases) These tests were checking for warning badges and log messages that no longer exist in the codebase.
1 parent eebed29 commit e403bc3

File tree

1 file changed

+0
-148
lines changed

1 file changed

+0
-148
lines changed

spec/dummy/spec/helpers/react_on_rails_helper_spec.rb

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

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

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

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

0 commit comments

Comments
 (0)