Skip to content

Commit a7fccea

Browse files
Remove Pro warning badge tests
Removed all test contexts for Pro warning badge functionality since the badge feature has been removed from the codebase. Tests removed: - react_component Pro license warning contexts - react_component_hash Pro license warning contexts - redux_store Pro license warning contexts
1 parent 9601c37 commit a7fccea

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
@@ -377,78 +377,6 @@ def helper.append_javascript_pack_tag(name, **options)
377377
it { is_expected.to include immediate_hydration_script }
378378
end
379379
end
380-
381-
describe "with Pro license warning" do
382-
let(:badge_html_string) { "React On Rails Pro Required" }
383-
384-
before do
385-
allow(Rails.logger).to receive(:warn)
386-
end
387-
388-
context "when Pro license is NOT installed and immediate_hydration is true" do
389-
subject(:react_app) { react_component("App", props: props, immediate_hydration: true) }
390-
391-
before do
392-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
393-
end
394-
395-
it { is_expected.to include(badge_html_string) }
396-
397-
it "logs a warning" do
398-
react_app
399-
expect(Rails.logger).to have_received(:warn)
400-
.with(a_string_matching(/The 'immediate_hydration' feature requires/))
401-
end
402-
end
403-
404-
context "when Pro license is NOT installed and global immediate_hydration is true" do
405-
subject(:react_app) { react_component("App", props: props) }
406-
407-
before do
408-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
409-
end
410-
411-
around do |example|
412-
ReactOnRails.configure { |config| config.immediate_hydration = true }
413-
example.run
414-
ReactOnRails.configure { |config| config.immediate_hydration = false }
415-
end
416-
417-
it { is_expected.to include(badge_html_string) }
418-
end
419-
420-
context "when Pro license is NOT installed and immediate_hydration is false" do
421-
subject(:react_app) { react_component("App", props: props, immediate_hydration: false) }
422-
423-
before do
424-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
425-
end
426-
427-
it { is_expected.not_to include(badge_html_string) }
428-
429-
it "does not log a warning" do
430-
react_app
431-
expect(Rails.logger).not_to have_received(:warn)
432-
end
433-
end
434-
435-
context "when Pro license IS installed and immediate_hydration is true" do
436-
subject(:react_app) { react_component("App", props: props, immediate_hydration: true) }
437-
438-
before do
439-
allow(ReactOnRails::Utils).to receive_messages(
440-
react_on_rails_pro_licence_valid?: true
441-
)
442-
end
443-
444-
it { is_expected.not_to include(badge_html_string) }
445-
446-
it "does not log a warning" do
447-
react_app
448-
expect(Rails.logger).not_to have_received(:warn)
449-
end
450-
end
451-
end
452380
end
453381

454382
describe "#react_component_hash" do
@@ -471,40 +399,6 @@ def helper.append_javascript_pack_tag(name, **options)
471399
expect(react_app).to have_key("componentHtml")
472400
expect(react_app).to have_key("title")
473401
end
474-
475-
context "with Pro license warning" do
476-
let(:badge_html_string) { "React On Rails Pro Required" }
477-
478-
before do
479-
allow(Rails.logger).to receive(:warn)
480-
end
481-
482-
context "when Pro license is NOT installed and immediate_hydration is true" do
483-
subject(:react_app) { react_component_hash("App", props: props, immediate_hydration: true) }
484-
485-
before do
486-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
487-
end
488-
489-
it "adds badge to componentHtml" do
490-
expect(react_app["componentHtml"]).to include(badge_html_string)
491-
end
492-
end
493-
494-
context "when Pro license IS installed and immediate_hydration is true" do
495-
subject(:react_app) { react_component_hash("App", props: props, immediate_hydration: true) }
496-
497-
before do
498-
allow(ReactOnRails::Utils).to receive_messages(
499-
react_on_rails_pro_licence_valid?: true
500-
)
501-
end
502-
503-
it "does not add badge to componentHtml" do
504-
expect(react_app["componentHtml"]).not_to include(badge_html_string)
505-
end
506-
end
507-
end
508402
end
509403

510404
describe "#redux_store" do
@@ -529,52 +423,6 @@ def helper.append_javascript_pack_tag(name, **options)
529423
it {
530424
expect(expect(store).target).to script_tag_be_included(react_store_script)
531425
}
532-
533-
context "with Pro license warning" do
534-
let(:badge_html_string) { "React On Rails Pro Required" }
535-
536-
before do
537-
allow(Rails.logger).to receive(:warn)
538-
end
539-
540-
context "when Pro license is NOT installed and immediate_hydration is true" do
541-
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
542-
543-
before do
544-
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
545-
end
546-
547-
it { is_expected.to include(badge_html_string) }
548-
549-
it "logs a warning" do
550-
store
551-
expect(Rails.logger).to have_received(:warn)
552-
.with(a_string_matching(/The 'immediate_hydration' feature requires/))
553-
end
554-
end
555-
556-
context "when Pro license is NOT installed and immediate_hydration is false" do
557-
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: false) }
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.not_to include(badge_html_string) }
564-
end
565-
566-
context "when Pro license IS installed and immediate_hydration is true" do
567-
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
568-
569-
before do
570-
allow(ReactOnRails::Utils).to receive_messages(
571-
react_on_rails_pro_licence_valid?: true
572-
)
573-
end
574-
575-
it { is_expected.not_to include(badge_html_string) }
576-
end
577-
end
578426
end
579427

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

0 commit comments

Comments
 (0)